How to browse securely with SSH and a SOCKS proxy

I was in Moab this weekend with my family and our motel had free wireless Internet. I used SSH and a SOCKS proxy to create a secure tunnel to my iMac at work. This allowed me to browse Gmail and Facebook securely.

Here’s a screencast on how to create an SSH tunnel and browse securely in Safari and Firefox:

Here’s a full-size video:
How to browse securely with SSH and a SOCKS proxy (full size video)

These are the basic steps on a Mac:
1. Open Terminal. (In your Applications/Utilities folder.)
2. Type “ssh -D 9999 username@example.com”, replacing “username” and “example.com” with the actual username and address of your remote machine. The remote machine will need the SSH service, or Remote Login service, turned on.
3. Open System Preferences -> Network -> Advanced tab -> Proxies.
4. Turn on the “SOCKS Proxy” and enter “127.0.0.1” and “9999” in the fields. Click OK and Apply.

Now your Internet connection will be tunneled through a secure connection to your remote machine — a poor man’s VPN.

4 thoughts on “How to browse securely with SSH and a SOCKS proxy”

  1. Thanks Richard, this is a cut and dry simple solution, I like it. I have used other methods before but this seems faster.

    I like Aaron’s idea too, but was wondering when you want to go back to non-proxy tunnel do you have to change the Firefox setting back or can you leave it at true?

  2. Don’t forget that DNS, however, will not be tunneled. If you want to tunnel DNS queries as well, in Firefox, pull up “about:config”, filter down “network.proxy.socks_remote_dns”, and change the value to “true”.

Comments are closed.