How to use ssh as a proxy server

Using ssh as a proxy or encrypted tunnel to browse the web can sometimes be necessary:

  1. When you’re at a conference but need to login securely to your blog.
  2. When local access restrictions make life really difficult.
  3. If you have a server in another country and want to see what Google Adsense adverts people see in that country.

I use ssh for the third reason. I want to see what adverts people in the USA see when they look at my blog so I can filter out the low paying and MFA ads (see notspam.org for more). Unfortunately I have a head like a sieve so unless it’s in the bash history I need to go look this up every few months:

ssh -D 8080 -Nf example.com

Replace example.com with your own hostname. That short command will create a socks5 proxy at 127.0.0.1:8080. Just configure your browser to talk to that and you’re surfing again!

Here’s a few external links you might find useful.

(I bet that when I most need to look up this post I’ll be behind a tight firewall that won’t let me at my blog ..)