如何阻止paramiko使用〜/ .ssh / id_rsa加密密钥?

时间:2017-01-28 11:49:56

标签: paramiko

我一直收到以下错误:

MediaStore.Albums

问题是我添加了我想以这种方式使用的密钥而且它没有加密:

Traceback (most recent call last):
  File "/home/d/workspace/paramiko/connect_test/main.py", line 127, in connect
    cStringIO.StringIO(local_settings.RSA_KEY)
  File "/home/d/virtualenv/lib/python2.7/site-packages/paramiko/client.py", line 380, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "/home/d/virtualenv/lib/python2.7/site-packages/paramiko/client.py", line 603, in _auth
    raise saved_exception
paramiko.ssh_exception.PasswordRequiredException: Private key file is encrypted

我认为它正在查看我加密的私钥〜/ .ssh / id_rsa。有没有办法阻止它做这件事?

1 个答案:

答案 0 :(得分:2)

Paramiko尝试回退到您的~/.ssh/密钥,并仅报告上一个错误。您可以通过将look_for_keys=False传递给connect()来停用回退行为,然后提出更有用的例外。