HOWTO set up an SOCKS proxy via an SSH tunnel on Mac OS X

Recently, I came across some streaming video that was only available to Canadians. Being a Canadian in the US, I felt somewhat entitled. Yes: I wanted to watch a hockey game.

I knew I could do this with an SSH tunnel. I just wasn’t sure how. There are lots of pages explaining how to set up SSH tunnels and proxies, but none were very clear or complete, and they didn’t explain what you had to do on the web browser end.

Step 1: Set up the SSH tunnel

ssh -D 8080 -f -C -q -N [email protected]

Step 2: Set up System Preferences

This is for Safari and other WebKit-based browsers. Note: this will also affect Mail and other CFNetwork-based applications.

  1. Select Apple > System Preferences
  2. Click Network
  3. Select the network interface you wish to use (i.e. AirPort)
  4. Click Advanced
  5. Click Proxies
  6. Select Configure Proxies > Manually (only necessary on Leopard and earlier)
  7. Check the box beside SOCKS Proxy
  8. fill in “localhost” and “8080”
  9. Click OK
  10. Click Apply

System Preferences SOCKS configuration

Step 3: Set up Firefox

  1. Select Firefox > Preferences
  2. Click Advanced
  3. Click Network
  4. Click Settings
  5. Click “Manual proxy configuration”
  6. Besides SOCKS Host, fill in “localhost” and “8080”
    Do not fill in any other fields, including “HTTP Proxy”
  7. Click SOCKS v5
  8. Click OK

Firefox SOCKS configuration

Join the Conversation

3 Comments

  1. Paul, I’ve wanted to be able to do something like this for a while and cannot believe it is this simple. Is there anything SSH can’t do? Thanks!

Leave a comment

Your email address will not be published. Required fields are marked *