Phase.org

This Too Shall Parse

Thoughts on Software Development by Richard George (richard@phase.org)

Trivial SSH tunnel

2007-10-10 09:52:00
Since the syntax for ssh tunnels is plain weird, and all the online examples are pretty much as impenetrable (generally assuming you want to route things via at least one third-party server), here's the basic syntax:

ssh -l routingUsername -L localhostPort:destinationServer:destinationPort -N routingServer &

Note that routingServer can be the same as destinationServer but is required! -N means don't open a shell, just build the tunnel, and the & is to background it as it naturally stays in the foreground.

eg, if your ISP is blocking port 25 outgoing, use:
ssh -l myusername -L 2525:my.remoteserver.com:25 -N my.remoteserver.com

and connect to port 25 locally.

Tags:

Archive