Repository navigation
Open
Milestone
Description
I'm using a windows client attempting to connect to an existing python kernel on an unbuntu server VM by following the guide here: https://github.com/ipython/ipython/wiki/Cookbook:-Connecting-to-a-remote-kernel-via-ssh
Upon running
[client] $ ipython qtconsole --existing ./kernel-1234.json --ssh server
I get the following error:
PS C:\Users\ogi> ipython qtconsole --existing .\Downloads\kernel-15235.json --ssh hwvmsrv
C:\Users\ogi\Miniconda3\lib\site-packages\paramiko\client.py:580: UserWarning: Unknown ssh-rsa host key for hwvmsrv: b'9
6b38225fac1d25f1f78ebb913d32f3d'
(key.get_name(), hostname, hexlify(key.get_fingerprint())))
[IPythonQtConsoleApp] ERROR | Could not setup tunnels
Traceback (most recent call last):
File "C:\Users\ogi\Miniconda3\lib\site-packages\IPython\consoleapp.py", line 239, in init_ssh
newports = tunnel_to_kernel(info, self.sshserver, self.sshkey)
File "C:\Users\ogi\Miniconda3\lib\site-packages\IPython\kernel\connect.py", line 357, in tunnel_to_kernel
if tunnel.try_passwordless_ssh(sshserver, sshkey):
File "C:\Users\ogi\Miniconda3\lib\site-packages\zmq\ssh\tunnel.py", line 78, in try_passwordless_ssh
return f(server, keyfile)
File "C:\Users\ogi\Miniconda3\lib\site-packages\zmq\ssh\tunnel.py", line 122, in _try_passwordless_paramiko
look_for_keys=True)
File "C:\Users\ogi\Miniconda3\lib\site-packages\paramiko\client.py", line 307, in connect
look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
File "C:\Users\ogi\Miniconda3\lib\site-packages\paramiko\client.py", line 444, in _auth
key = pkey_class.from_private_key_file(key_filename, password)
File "C:\Users\ogi\Miniconda3\lib\site-packages\paramiko\pkey.py", line 183, in from_private_key_file
key = cls(filename=filename, password=password)
File "C:\Users\ogi\Miniconda3\lib\site-packages\paramiko\rsakey.py", line 55, in __init__
self._from_private_key_file(filename, password)
File "C:\Users\ogi\Miniconda3\lib\site-packages\paramiko\rsakey.py", line 165, in _from_private_key_file
data = self._read_private_key_file('RSA', filename, password)
File "C:\Users\ogi\Miniconda3\lib\site-packages\paramiko\pkey.py", line 254, in _read_private_key_file
with open(filename, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: ''
I installed paramiko, however still having no success.
Suggestions?
Metadata
Metadata
Assignees
Labels
No labels
Activity
j9ac9k commentedon May 17, 2015
I should note, that I did create a RSA public/private key pair, and added the public key to authorized_keys file in my servers's ~/.ssh directory.
Using git-bash, I was able to confirm that the SSH key's was working, however I still get the same error:
takluyver commentedon May 17, 2015
Is your paramiko up to date? Where is the private key saved on your local machine. You can see where paramiko looks here.
I think there's a bug in paramiko, at least in that it should fail earlier with a more meaningful error, rather than trying to open
''as a file.j9ac9k commentedon May 17, 2015
Paramiko is version 1.15.2, pycrypto is 2.6.1.
On my local machine, my keys are in ~/.ssh ; or more specifically:
"C:\Users\ogi\.ssh\id_rsa"How would it be best to try and isolate the bug to paramiko itself; or should I open an issue in their repo?
takluyver commentedon May 17, 2015
The relevant lines of code running in pyzmq are here:
https://github.com/zeromq/pyzmq/blob/v14.6.0/zmq/ssh/tunnel.py#L117
If you can replicate the error by running just those lines, that isolates it to Paramiko.
j9ac9k commentedon May 18, 2015
Thanks for following up.
I guess this looks like a problem with paramiko:
Line 1 of my known_hosts file (in the same directory as my RSA key) is
triple dot indicating the key extends a ways.
takluyver commentedon May 18, 2015
Ah, looking at that more closely, I think the original problem may not be in paramiko - it looks like we're passing in an empty string for keyfile. Possibly we should be passing
Noneif a key is not specified instead. @minrk ?Don't know about the new error.
j9ac9k commentedon May 18, 2015
I'll open up an issue regarding the known_hosts extension and see what they have to say.
Thanks for investigating.
Carreau commentedon Jun 12, 2015
Has this been solved ?
j9ac9k commentedon Jun 12, 2015
Will investigate this weekend
On Jun 12, 2015 11:19 AM, "Matthias Bussonnier" [email protected]
wrote:
Carreau commentedon Jun 12, 2015
No hurry .
j9ac9k commentedon Jun 14, 2015
I just confirmed the issue still exists:
I then retrieve the kernel-15047.json file, and edit the ip address to match the ip address of the server
To make sure this was just an ipython issue, I managed to establish connectivity with paramiko through git bash.
Let me know if there is any testing I can do to be of help.
sdemyanov commentedon Jul 28, 2015
Have the same problem Is there any update on it?
P.S. the problem was solved by "easy_install pexpect"
kondor6c commentedon Oct 31, 2016
I set out to test this issue and I was able to replicate the issue given similar circumstances. After I had the failure mentioned above, I started ssh tunnels and I was able to connect. Here is a screen shot demonstrating that (due to the graphical nature of Windows), I also have console output below.
.
menghuu commentedon Nov 20, 2017
i also have this problems too. except i do not have private/public key. the error output just like yours
also, i try to connect the remote ipython kernel (client is wsl, server is ubuntu), it gets stuck
anyone can help?
ronald-jaepel commentedon Nov 23, 2018
I bumped into the same problem.
The problem is, as @takluyver mentioned, that the default value for the sshkey value created in "jupyter_client/consoleapp.py" is
sshkey = Unicode('', config=True, help="""Path to the ssh key to use for logging in to the ssh server.""")here
but paramiko only tests for None to see if no keyfile was specified.
First I tried manually setting the sshkey value to None from the command line.
jupyter qtconsole --JupyterQtConsoleApp.sshkey=None --existing etcwhich returned
[JupyterQtConsoleApp] CRITICAL | The 'sshkey' trait of a JupyterQtConsoleApp instance must be a unicode string, but a value of None <class 'NoneType'> was specified.What finally worked, as a quick dirty workaround, was to change the value in the consoleapp.py file (line 122) to default to None. Now things work, but it feels terrible.
What is your opinion on further steps? Should this be closed and an issue be opened at paramiko to include tests for emtpy strings? That's what I would do.
takluyver commentedon Nov 23, 2018
I don't think there's much obvious advantage between making the default
Noneand making paramiko test for empty strings. Given what you've found, I'd be fine with making the default None injupyter_client.