sftp

How do you start Python Paramiko SFTP with sudo?

半腔热情 提交于 2020-02-02 08:58:26
问题 Using the standard client.open_sftp() handle gives me SFTP controls but without sudo/root permissions, any sort of /etc/** files can't be edited. I have a user that has passwordless sudo access, I figured I could maybe start off with sudo su and then invoke SFTP but that did not seem to be the case. t = paramiko.Transport(('192.168.56.102', 22)) t.connect(username='vagrant', password='vagrant') chan = t.open_session() chan.get_pty() chan.invoke_subsystem('sftp') chan.exec_command('sudo su')

How do you start Python Paramiko SFTP with sudo?

感情迁移 提交于 2020-02-02 08:54:13
问题 Using the standard client.open_sftp() handle gives me SFTP controls but without sudo/root permissions, any sort of /etc/** files can't be edited. I have a user that has passwordless sudo access, I figured I could maybe start off with sudo su and then invoke SFTP but that did not seem to be the case. t = paramiko.Transport(('192.168.56.102', 22)) t.connect(username='vagrant', password='vagrant') chan = t.open_session() chan.get_pty() chan.invoke_subsystem('sftp') chan.exec_command('sudo su')

Recursive directory copy with Paramiko in Python

妖精的绣舞 提交于 2020-02-01 08:04:10
问题 I am new to Python scripting. I need to copy few folders from my local machine (windows) to Linux server. As of now, I am copying the folders by opening WinSCP console. I need to automate this process. I have written a below code in Python using Paramiko module library. import paramiko import os transport = paramiko.Transport(('10.10.10.10', 22)) transport.connect(username='weblogic', password='weblogic') sftp = paramiko.SFTPClient.from_transport(transport) filepath = '/apps/logs' localpath =

List files on SFTP server matching wildcard in Python using Paramiko

孤街醉人 提交于 2020-01-29 16:56:05
问题 import paramiko client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect('hostname', username='test1234', password='test') path = ['/home/test/*.txt', '/home/test1/*.file', '/home/check/*.xml'] for i in path: for j in glob.glob(i): print j client.close() I am trying to list the wildcard files on remote server by using glob.glob . But glob.glob() is not working. Using Python 2.6. Remote server contains these files: /home/test1/check.file , /home

Sublime sftp connects to wrong container

寵の児 提交于 2020-01-25 04:05:12
问题 I have two different Docker containers under the same host stack. Currently I'm on OSX and using Sublime Text 3 with the SFTP plugin. For each different dev environment (Docker container) I have a different sftp-config.json file and I am using different SSH key files. Here are my host entries for both files: first host: "host": "example-dev.xxx.de", "user": "userxxx", "remote_path": "/home/xxx/www_trunk", "ssh_key_file": "~/work/Misc/pass/private1.pem" second host: "host": "example2-dev.xxx

Unable to cache SFTP connection with Spring Integration

醉酒当歌 提交于 2020-01-25 01:35:49
问题 I need to transfer several small files via SFTP using spring integration, so I'd like to reuse a connection once established to avoid the overhead of creating a new one for every single message. This is my current configuration: <bean id="sftpTARGETSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"> <constructor-arg name="isSharedSession" value="true"/> <property name="host" value="${TARGET.push.host}"/> <property name="user" value="${TARGET.push

Why does SFTP via PHP fail, but succeeds in FileZilla on my Windows 8.1 machine?

邮差的信 提交于 2020-01-24 18:46:04
问题 In PHP, I cannot even get the SFTP connection to work. I have tried to use the native SFTP functionality (ssh_connect), and it fails to connect. I have also tried to use phpseclib, but it fails as well. Neither of my aforementioned attempts have provided much in the way of log info. The native code: if (!function_exists('ssh2_connect')) { echo "dll not loaded properly"; //never see this, so I know it works return false; } $connection = ssh2_connect('sftp.example.com', 22); ssh2_auth_password(

VFS2 Error cannot delete file and could not get the groups id of the current user (error code: -1)

岁酱吖の 提交于 2020-01-24 03:26:29
问题 I'm using VFS2 to take and import files into the folders by SFTP protocol. But I'm obtaining an Error. Picture below my code: Into the log for all files I'm watching this error: The error sequence is: 1) cannot delete file 2) Could not determine if file 3) Caused by: com.jcraft.jsch.JSchException: Could not get the groups id of the current user (error code: -1) Properties folder: Could it dependens on the owner/groups ? 回答1: This is a known issue - see https://issues.apache.org/jira/browse

Automate file transfer activity from local machine to remote machine using WinSCP script

时间秒杀一切 提交于 2020-01-24 01:43:28
问题 I want to transfer file(s) in bulk (approx 50 files at a time) from my local machine to remote machine (Linux server) and I wanted to automate this activity using WinSCP. I already have generated code by doing manually in WinSCP. Saved the code and created batch file. But it is throwing error like The filename, directory name, or volume label syntax is incorrect The system cannot find the path specified. However the given destination and source are valid/correct. @echo "open sftp:/

How to write SFTP client using Apache MINA library

让人想犯罪 __ 提交于 2020-01-24 01:43:09
问题 I tried finding Java code for SFTP client using Apache MINA library but couldn't find it. Could someone show me how to write a simple password authentication based SFTP client using Apache MINA library. https://mina.apache.org/sshd-project/apidocs/org/apache/sshd/client/subsystem/sftp/SftpClient.html 回答1: Based on the examples in the readme of apache-sshd-2.2.0-src package: SshClient client = SshClient.setupDefaultClient(); // override any default configuration... client.setSomeConfiguration(