मैं फ़ाइलों के पुनर्प्राप्ति को स्वचालित करने के लिए पाइथन (पैरामीको का उपयोग करके) से दूरस्थ सर्वर पर एसएफटीपी से कनेक्ट करने का प्रयास कर रहा हूं।कुंजी और उपयोगकर्ता नाम/पासवर्ड के साथ पैरामीको एसएफटीपी - "ओह, अनचाहे प्रकार 3"
सिस्टम संस्करण: ओएस: मैक ओएस एक्स शेर पायथन: 2.7.1 Paramiko: 1.7.7.2
मेरे सबसे छोटा उदाहरण:
key_file = '/absolute/path/to/.ssh/id_rsa_key' # NOT .pub
key_passphrase = 'id_rsa_key_passphrase'
host = 'ftp.test.com'
port = 22
username = 'my_ftp_username'
password = 'my_ftp_password'
# SSH Key
my_key = paramiko.RSAKey.from_private_key_file(key_file, password=key_passphrase)
# SFTP Connection
transport = paramiko.Transport((host, port))
transport.connect(username=username, password=password, pkey=my_key)
sftp = paramiko.SFTPClient.from_transport(transport)
# Print something
print sftp.listdir()
# Close connections
sftp.close()
transport.close()
ऊपर निम्नलिखित लॉग उत्पादन उत्पन्न करता है:
DEB [20120606-16:20:46.121] thr=1 paramiko.transport: starting thread (client mode): 0x8ae7dd0L
INF [20120606-16:20:46.241] thr=1 paramiko.transport: Connected (version 2.0, client All)
DEB [20120606-16:20:46.242] thr=1 paramiko.transport: kex algos:['diffie-hellman-group1-sha1', 'diffie-hellman-group-exchange-sha1'] server key:['ssh-rsa'] client encrypt:['aes256-cbc', 'aes192-cbc'] server encrypt:['aes256-cbc', 'aes192-cbc'] client mac:['hmac-sha1', 'hmac-sha1-96'] server mac:['hmac-sha1', 'hmac-sha1-96'] client compress:['none'] server compress:['none'] client lang:[''] server lang:[''] kex follows?False
DEB [20120606-16:20:46.242] thr=1 paramiko.transport: Ciphers agreed: local=aes256-cbc, remote=aes256-cbc
DEB [20120606-16:20:46.242] thr=1 paramiko.transport: using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes256-cbc, remote aes256-cbc; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
DEB [20120606-16:20:46.673] thr=1 paramiko.transport: Switch to new keys ...
DEB [20120606-16:20:46.706] thr=2 paramiko.transport: Attempting password auth...
DEB [20120606-16:20:47.112] thr=1 paramiko.transport: userauth is OK
INF [20120606-16:20:50.288] thr=1 paramiko.transport: Authentication continues...
DEB [20120606-16:20:50.288] thr=1 paramiko.transport: Methods: ['password', 'publickey']
DEB [20120606-16:20:50.305] thr=2 paramiko.transport: [chan 1] Max packet in: 34816 bytes
WAR [20120606-16:20:50.405] thr=1 paramiko.transport: Oops, unhandled type 3
INF [20120606-16:23:53.582] thr=1 paramiko.transport: Disconnect (code 11): Idle connection
क्या किसी को पता है कि लॉग में "ओह, अनचाहे प्रकार 3" क्या है? ऐसा लगता है जब पूरी चीज अलग हो जाती है। वैकल्पिक रूप से, अगर कोई कुछ देखता है तो मैं कोड में बहुत गलत कर रहा हूं जो सहायक भी होगा।
यह (अप्रत्याशित) बग आपके द्वारा देखे जा रहे मुद्दे को कवर करने के लिए प्रतीत होता है: https://github.com/paramiko/paramiko/issues/519 – Symmetric