Reverse SSH Tunnel

Create and maintain a reverse ssh tunnel.

I have some computers located behind firewalls and/or NAT, but I need to access these machines remotely. The network address often changes, and the network connection is not reliable. In some cases, the network connection can only be established from the remote computer. The remote tunnel script provides a way to access these computers fairly reliably.

0.1 11oct11

This script establishes an ssh tunnel and tries to maintain it using autossh. It can be run many times - if the tunnel is established, then the script does nothing.

To use this script, run it repeatedly as a cron task on the remote system. For example:

0,15,30,45 * * * * /home/username/bin/

When the connection has been establish, connect to the remote system by logging in to the local system then doing this:

ssh localhost -p 2222