Repository navigation
Closed
Description
I am trying to connect my ipython kernel to an existing kernel running on another machine through ssh. I was having trouble there and opened up an issue there that can be found here:
With some guidance, it appears the issue is with paramiko.
For reference, I am running this on Windows 8.1 x64, I'm using git-bash for my command line work. I have python 3.4.3 installed and paramiko 1.15.2.
ogi@OGI-DESKTOP ~/Downloads
$ ssh ogi@hwvmsrv
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-37-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Sun May 17 17:06:06 PDT 2015
System load: 0.0 Processes: 106
Usage of /: 31.6% of 17.58GB Users logged in: 1
Memory usage: 5% IP address for eth0: 192.168.1.130
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
0 packages can be updated.
0 updates are security updates.
Last login: Sun May 17 17:06:07 2015 from 192.168.1.120
ogi@hwvmsrv:~$ exit
logout
Connection to hwvmsrv closed.
ogi@OGI-DESKTOP ~/Downloads
$ ipython
Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:06:10) [MSC v
.1600 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 3.1.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import paramiko
In [2]: client = paramiko.SSHClient()
In [3]: client.load_system_host_keys()
In [4]: server = 'hwvmsrv'
In [5]: username = 'ogi'
In [6]: port = 22
In [7]: keyfile = "C:\\Users\\ogi\\.ssh\\id_rsa"
In [8]: client.connect(server, port, username=username, key_filename=keyfile, lo
ok_for_keys=True)
---------------------------------------------------------------------------
SSHException Traceback (most recent call last)
<ipython-input-8-68c07a1ff1cf> in <module>()
----> 1 client.connect(server, port, username=username, key_filename=keyfile, lo
ok_for_keys=True)
c:\Users\ogi\Miniconda3\lib\site-packages\paramiko\client.py in connect(self, ho
stname, port, username, password, pkey, key_filename, timeout, allow_agent, look
_for_keys, compress, sock, gss_auth, gss_kex, gss_deleg_creds, gss_host, banner_
timeout)
286 # will raise exception if the key is rejected; let that
fall out
287 self._policy.missing_host_key(self, server_hostkey_name,
--> 288 server_key)
289 # if the callback returns, assume the key is ok
290 our_server_key = server_key
c:\Users\ogi\Miniconda3\lib\site-packages\paramiko\client.py in missing_host_key
(self, client, hostname, key)
568 client._log(DEBUG, 'Rejecting %s host key for %s: %s' %
569 (key.get_name(), hostname, hexlify(key.get_fingerpri
nt())))
--> 570 raise SSHException('Server %r not found in known_hosts' % hostna
me)
571
572
SSHException: Server 'hwvmsrv' not found in known_hosts
first line of known_hosts file (in same directory as id_rsa file)
hwvmsrv,192.168.1.130 ecdsa-sha2-nistp256 <key>
Any suggestions would be greatly appreciated.
Reacted by Brendon John Muschamp
Metadata
Metadata
Assignees
Labels
No labels
Activity
bitprophet commentedon May 21, 2015
Pretty sure this is a dupe of one of these tickets here: known_hosts - couple potential causes, if possible you should look into those scenarios and see which applies in your situation. Please follow whichever ticket seems to match best, or comment back here if you can provide confirmation that none of them apply :) Thanks!
j9ac9k commentedon May 22, 2015
I did manage to get a connection when I enabled an AutoAddPolicy() for the connection. If there is another means of troubleshooting, please advise.
However going through the list of issues and the pull requests
So #490 isn't relative to me:
#437 deals with poor performance with loading known_hosts file which isn't relevant to me
I'm not sure how to address #435.
#138 deals with multiple keys for one server, I don't think it's an applicable situation, but it could be mistaken. I'm not sure how to implement the workaround that @gfxmonk implemented.
I implemented #401 but I still got the same error.
bitprophet commentedon May 23, 2015
OK, I didn't look closely enough at your output - the key type
ecdsa-sha2-nistp256made me realize it's actually probably #243 or #473 (both of which I just added to the known_hosts label, that feels like an oversight).drno-reg commentedon Apr 4, 2017
Hello,
May be connect to server by SSH without using key_filename?
for example
p.s.
now tried this code I got errors
emilianobaum commentedon Apr 9, 2020
this work from me:
s.set_missing_host_key_policy(AutoAddPolicy())