有时回到下面的代码可以正常工作,并且我能够连接远程服务器。但是突然之间,我从今天开始面临以下问题。请提出任何建议。
import paramiko
import os
ssh_remote =paramiko.SSHClient()
ssh_remote.set_missing_host_key_policy(paramiko.AutoAddPolicy())
privatekeyfile = os.path.expanduser('~/.ssh/id_key')
mykey = paramiko.RSAKey.from_private_key_file(privatekeyfile, password='test123')
ssh_remote.connect('10.10.10.10', username = 'test', pkey = mykey)
错误
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/paramiko/pkey.py", line 206, in from_private_key_file
key = cls(filename=filename, password=password)
File "/usr/local/lib/python2.7/site-packages/paramiko/rsakey.py", line 48, in __init__
self._from_private_key_file(filename, password)
File "/usr/local/lib/python2.7/site-packages/paramiko/rsakey.py", line 170, in _from_private_key_file
self._decode_key(data)
File "/usr/local/lib/python2.7/site-packages/paramiko/rsakey.py", line 182, in _decode_key
raise SSHException(str(e))
paramiko.ssh_exception.SSHException: Could not deserialize key data.
id_key
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,89F3HUKJILLNND
MIICWwIBAAKBgQDdlatRjRjogo3WojgGHFHYLugdUWAY9iR3fy4arWNA1
KoS8kVw33cJibXr8bvwUAUparCwlvdbH6dvEOfou0/gCFQsHUfQrSDv+M
uSUMAe8jzKE4qW+jK+xQU9a03GUnKHkkle+Q0pX/g6jXZ7r1xAK5Do2kQ
+X5xK9cipRgEKwIDAQABAoGAD+onAtVye4ic7VR7V50DF9bOnwRwNXrAR
cDhq9LWNRrRGElESYYTQ6EbatXS3MCyjjX2eMhuaF5YhXBwkppwxg+EOm
Xeh+MzL7Zh284OuPbkglAaGhV9bb6/5CpuGb1esyPbYW+Ty2PC0GSZfIX
kXs76jXAu9TOBvD0ybc2YlkCQQDyMIICWwIBAAKBgQDdlatRjRjogo3Wo
KoS8kVw33cJibXr8bvwUAUparCwlvdbH6dvEOfou0/gCFQsHUfQrSDv+M
uSUMAe8jzKE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