Trivial SSH tunnel

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.
Posted by parsingphase, 2007-10-10 09:52

Anonymous user

Login

I'm currently available for contract work in London as a Senior PHP Developer. Contact me for a CV, rates, or a chat.

Twitter: @parsingphase

Email: richard@phase.org

Github: parsingphase

LinkedIn: Richard George

Flickr: parsingphase