rpyc.utils.ssh not found

136 views
Skip to first unread message

ldogs

unread,
Sep 9, 2015, 1:24:06 PM9/9/15
to rpyc
I'm having trouble implementing an SSH-tunnel, following http://rpyc.readthedocs.org/en/latest/docs/secure-connection.html

Specifically rpyc.utils.ssh doesn't exist, so that I can't import SshContext. I have ssh for python installed.

Things I've tried so far:
  • Windows (8.1) and Linux (Ubuntu 14.04)
  • Different version of rpyc (pip install -Iv rpyc==3.22)
  • Different version of Python (2.7 and 3.4)

Any suggestions on how to get the correct version of rpyc?

ldogs

unread,
Sep 9, 2015, 2:14:33 PM9/9/15
to rpyc
I got a bit further:
  • Installed version 3.2.0: (pip uninstall rpyc, pip install -Iv rpyc==3.2.0). This version has rpyc.utils.ssh.SshContext
  • Using rpyc.utils.classic.ssh_connect instead of rpyc.ssh_connect (does not exist)
Currently I'm getting an error: "The system cannot find the file specified". I'm guessing because 'ssh' is not defined at command-line in Windows.

ldogs

unread,
Sep 9, 2015, 6:00:54 PM9/9/15
to rpyc
In case anyone has the same issue, I managed to struggle my way through this:

You can use the current version of rpyc, in combination with plumbum. Plumbum provides a 'PuttyMachine', which can be used to connect to the remote server and create a tunnel. However, for some reason the PuttyMachine.tunnel causes errors which I was not able to solve. I started out by setting up my own tunnel from command-line, and retrofitted this to plumbum.

My solution now looks like this:

keyfile = "key"
local_port = 1111
remote_port = 18861
remote_ip = "x.x.x.x"
remote_user = "user"
ssh_command = plumbum.local["C:\Program Files (x86)\PuTTY\plink.exe"][('-L','{}:localhost:{}'.format(local_port,remote_port))]
scp_command = plumbum.local["C:\Program Files (x86)\PuTTY\pscp.exe"]

remote = plumbum.PuttyMachine(remote_ip, user=remote_user, port=22, keyfile=keyfile,ssh_command=ssh_command, scp_command=scp_command)
with remote:
    conn = rpyc.connect("localhost", local_port)
    # Do rpyc stuff here





On Wednesday, September 9, 2015 at 7:24:06 PM UTC+2, ldogs wrote:
Reply all
Reply to author
Forward
0 new messages