Linux.com

Access remote network services with SSH tools

Posted by: Anonymous [ip: 24.82.209.151] on November 17, 2008 10:10 PM
What about if you have to go through a firewall?
ssh -t firewall.example.com ssh -t desktop.example.com

What about SOCKS4/5 access? Set your proxy to localhost port 1080, and type:
ssh -t -L 1080:127.0.0.1:1080 firewall.example.com ssh -t -D 1080 desktop.example.com

And the ever-popular sshfs through a firewall:
ssh -t -L 24:127.0.0.1:24 firewall.example.com ssh -t -L 24:127.0.0.1:22 desktop.example.com
mkdir /mnt/point
sshfs -p 24 localhost: /mnt/point
cd /mnt/point
ls -la

Also, the 'autossh' (http://www.harding.motd.ca/autossh/) command comes in handy, keeping connections alive forever. This command will connect to the firewall, and set up port 26 (bound to localhost) on the firewall as a way to ssh into your current machine. This is useful when you can only make outbound connections from where you are:
autossh -M 1 -N -R 26:127.0.0.1:22 firewall.example.com

Make sure you have a recent version of ssh, so that different ports on the same host can have different host keys, or else you'll be irritated!

#

Return to Access remote network services with SSH tools