Setup a ssh local port forwarding with Python's sshtunnel

40 views Asked by At

I've got the following open ssh client command to setup a local port forwarding:

ssh -i <keyfile> -o HostKeyAlgorithms=ssh-rsa -o StrictHostKeyChecking=no -L <localPort>:<remoteHost>:<remotePort> <user>@<remoteServerIP> -fN

How can I do exactly the same in Python with the sshtunnel library? https://sshtunnel.readthedocs.io/en/latest/

The sshtunnel's documentation has no example for using key files, in this case the key file contains a RSA PRIVATE KEY.

0

There are 0 answers