pahaz / sshtunnel

SSH tunnels to remote server.
MIT License
1.23k stars 184 forks source link

how to use sshtunnel to setup local port forwarding #254

Open winnietsang opened 2 years ago

winnietsang commented 2 years ago

I want to access to a private host from my local client. How can I use sshtunnel and paramiko to run the following ssh commands in this order: ssh userA@hostA -i key_file -L 5434:localhost:9876 # local port forwarding from port 5434 to hostA:9876 and ssh to hostA as userA ssh userA@hostB # ssh from hostA to hostB as userA

I try to use sshtunnel.SSHTunnelForwarder and paramiko.SSHClient but I can't get it working. Hope I can get some advice. Thanks.

survivor956 commented 2 years ago

did you get "Could not open/establish connection to SSH gateway" Error ?

Are you using ssh key or password ?