|
Table of Contents
How to make a reverse SSH tunnelWhat is a reverse SSH tunnel?You want to connect your local machine to a server, so that you can use the tunnel to connect from the server to your local machine. This works without port forwarding in routers and often through firewalls. local machine ———» starts reverse tunnel to the ———» server. server ———» connects via the tunnel to the ———» local machine. How to make a reverse SSH tunnel?On the local machine execute: ssh -p222 -nNTR 2223:localhost:22 username@90.123.23.11 where in this example
Again, with placeholders: ssh -p<sshd port server> -nNTR <forwarded port server>:localhost:<sshd port local> <username>@<ip server> How to connect via the reverse SSH tunnel?To connect from the server to the local machine, that initiated the tunnel, use the following command on the server: ssh -p2223 username@localhost where
Other commands
Use sudo apt-get install autossh autossh -p222 -nNTR 2223:localhost:22 username@90.123.23.11 Use public key authentification and make an @reboot cronjob to automatically create the tunnel. Comments |