SSH as SOCKS Proxy
I don’t know why I didn’t know this before, but OpenSSH has built-in support to act as a SOCKS proxy. All you have to do is use the -D
option:
ssh -D 1080 user@example.com
And then setup your SOCKS proxy as “localhost:1080”. Voila! Why would you do this? The main reason is that you don’t trust whatever network you are on not to snoop where you surf. So while not something I will use every day, it is very good to know the option is there, if I need it.
One point to note if you try this on Mac OS X. The version of OpenSSH shipped with OS X 10.3.5 is 3.6.1. Unfortunately, this version only supports SOCKS4, and Safari uses SOCKS5. This is easily remedied by installing OpenSSH version 3.7.1 using Fink:
apt-get install openssh
Ah… easy as pie!