![]() |
SFTP transfer using paramiko fails - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: SFTP transfer using paramiko fails (/thread-12673.html) |
SFTP transfer using paramiko fails - estebanup03 - Sep-06-2018 Hi Amigos, I need to automate a file transfer via SFTP to several devices and i have found thousands of code using paramiko i am not very experienced with python and i took the code below but is not working i have done a lot of debugs and it seems a problem with paths but i have tried a lot of things and couldnt solve it, appreciate your kind help with any recommendation. Details: Code error execution as follows: TSHOOT: I´ve checked paramiko generated log and i can see the following error:DEB [20180906-11:57:27.368] thr=1 paramiko.transport: Kex agreed: diffie-hellman-group-exchange-sha1 DEB [20180906-11:57:27.368] thr=1 paramiko.transport: HostKey agreed: ssh-rsa DEB [20180906-11:57:27.368] thr=1 paramiko.transport: Cipher agreed: aes128-ctr DEB [20180906-11:57:27.368] thr=1 paramiko.transport: MAC agreed: hmac-sha2-256 DEB [20180906-11:57:27.368] thr=1 paramiko.transport: Compression agreed: none DEB [20180906-11:57:27.539] thr=1 paramiko.transport: Got server p (2048 bits) DEB [20180906-11:57:28.223] thr=1 paramiko.transport: kex engine KexGex specified hash_algo <built-in function openssl_sha1> DEB [20180906-11:57:28.223] thr=1 paramiko.transport: Switch to new keys ... DEB [20180906-11:57:28.255] thr=2 paramiko.transport: Attempting password auth... DEB [20180906-11:57:28.499] thr=1 paramiko.transport: userauth is OK INF [20180906-11:57:29.130] thr=1 paramiko.transport: Authentication (password) successful! DEB [20180906-11:57:29.154] thr=2 paramiko.transport: [chan 0] Max packet in: 32768 bytes DEB [20180906-11:57:29.332] thr=1 paramiko.transport: [chan 0] Max packet out: 32768 bytes DEB [20180906-11:57:29.334] thr=1 paramiko.transport: Secsh channel 0 opened. DEB [20180906-11:57:29.403] thr=1 paramiko.transport: [chan 0] Sesch channel 0 request ok INF [20180906-11:57:29.549] thr=2 paramiko.transport.sftp: [chan 0] Opened sftp connection (server version 3) DEB [20180906-11:57:29.555] thr=2 paramiko.transport.sftp: [chan 0] open('sd1:/ipsec_monitoringv2.py', 'wb') DEB [20180906-11:57:29.838] thr=1 paramiko.transport: EOF in transport thread System info: Windows 10 64 bit Python 2.7.15 Code: import paramiko import subprocess ssh_client = paramiko.SSHClient() ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh_client.connect('10.0.0.1', 22, 'python', 'python') sftp = ssh_client.open_sftp() sftp.put('test.py','/test.py') sftp.close() ssh_client.close() |