決定給Python的首次嘗試,很抱歉,如果答案是顯而易見的Python的 - 的paramiko收到錯誤「對象有沒有屬性‘get_fingerprint’
我試圖創建一個使用的paramiko SSH連接。我使用下面的代碼:
#!/home/bin/python2.7
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("somehost.com", username="myName", pkey="/home/myName/.ssh/id_rsa.pub")
stdin, stdout, stderr = ssh.exec_command("ls -l")
print stdout.readlines()
ssh.close()
漂亮的標準的東西,對不對除了我得到這個錯誤:??
./test.py
Traceback (most recent call last):
File "./test.py", line 10, in <module>
ssh.connect("somehost", username="myName", pkey="/home/myName/.ssh/id_rsa.pub")
File "/home/lib/python2.7/site-packages/paramiko/client.py", line 327, in connect
self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys)
File "/home/lib/python2.7/site-packages/paramiko/client.py", line 418, in _auth
self._log(DEBUG, 'Trying SSH key %s' % hexlify(pkey.get_fingerprint()))
AttributeError: 'str' object has no attribute 'get_fingerprint'
什麼「STR」對象是指我以爲我濱海ely不得不通過它到RSA密鑰的路徑,但它似乎想要一些對象。