添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the key I try to use is not added to authorized_keys on the remote host,
and ~/.ssh/id_rsa on a local host doesn't exist but key_filename is provided instead
misleading 'not a valid EC private key file' exception is rised

Here's some traceback:

  File "/home/test/venv/lib/python3.4/site-packages/paramiko/client.py", line 307, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "/home/test/venv/lib/python3.4/site-packages/paramiko/client.py", line 519, in _auth
    raise saved_exception
  File "/home/test/venv/lib/python3.4/site-packages/paramiko/client.py", line 444, in _auth
    key = pkey_class.from_private_key_file(key_filename, password)
  File "/home/test/venv/lib/python3.4/site-packages/paramiko/pkey.py", line 183, in from_private_key_file
    key = cls(filename=filename, password=password)
  File "/home/test/venv/lib/python3.4/site-packages/paramiko/ecdsakey.py", line 49, in __init__
    self._from_private_key_file(filename, password)
  File "/home/test/venv/lib/python3.4/site-packages/paramiko/ecdsakey.py", line 147, in _from_private_key_file
    data = self._read_private_key_file('EC', filename, password)
  File "/home/test/venv/lib/python3.4/site-packages/paramiko/pkey.py", line 255, in _read_private_key_file
    data = self._read_private_key(tag, f, password)
  File "/home/test/venv/lib/python3.4/site-packages/paramiko/pkey.py", line 264, in _read_private_key
    raise SSHException('not a valid ' + tag + ' private key file')
paramiko.ssh_exception.SSHException: not a valid EC private key file

If ~/.ssh/id_rsa does exis, the proper exception is raised:

paramiko.ssh_exception.AuthenticationException: Authentication failed.