Open
Description
Connecting to SSH session on remote port 2222
Traceback (most recent call last):
File "/usr/local/share/python/relay", line 9, in <module>
load_entry_point('relay==0.0.8', 'console_scripts', 'relay')()
File "/usr/local/lib/python2.7/site-packages/relay.py", line 187, in _main
func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/relay.py", line 281, in ssh
key_filename=env['pair_private_key']
File "/usr/local/lib/python2.7/site-packages/paramiko/client.py", line 321, in connect
self._policy.missing_host_key(self, server_hostkey_name, server_key)
File "/usr/local/lib/python2.7/site-packages/paramiko/client.py", line 85, in missing_host_key
raise SSHException('Server %r not found in known_hosts' % hostname)
paramiko.SSHException: Server '[54.244.243.254]:2222' not found in known_hosts
Activity
jmsalomr commentedon Oct 17, 2013
Hi,
I have the same problem. Is this a bug or I'm doing something wrong. I'm using paramiko in Python 2.7 32 bits over Windows 7.
jmsalomr commentedon Oct 17, 2013
Sorry, solved.
You have to use:
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) before
ghost commentedon May 31, 2014
You need add: ssh.load_system_host_keys() ..before ssh.connect
anirudt commentedon Dec 25, 2015
+1 @jmsalomr , that worked. Thanks.
anunayamar commentedon Feb 10, 2016
@jmsalomr you saved my time. Thanks!!
zlshi commentedon Aug 23, 2016
+1 @jmsalomr , that worked. Thanks.
tao12345666333 commentedon Oct 31, 2016
@jmsalomr Thanks.
AlexandreLicinio commentedon Sep 11, 2017
@jmsalomr thanks :) 👍
zed commentedon Feb 2, 2018
To modify
~/.ssh/known_hosts
file (to save the keys permanently) in addition toAutoAddPolicy()
, useclient.load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
. Note:AutoAddPolicy()
opens you to the MITM attack. See Paramiko: Add host_key to known_hosts permanently.[unknown_host](onyxfish/relay#11)
usama767 commentedon Aug 13, 2020
i get this error
TypeError: 'NoneType' object is not callable
what is the step i am missing or doing wrong? @jmsalomr
akliorin commentedon Dec 4, 2020
@usama767
I ran into both of the issues in this thread.
First, adding the autopolicy does work most of the time.
To fix the NoneType error, I went to //.ssh and deleted everything. Started working.