Really Simple Proxy using SSH

Sometimes it’s useful to exist on the Internet as though you were in a different country. The reasons for this can vary: maybe you’re want to use a website that’s only available in your home country; or, like happened to me today, maybe you need to see how your clients in another country experience geo-targetted ads served onto their website.

There are many ways to achieve this, many of which either don’t work, involve some expense, or are complicated.

Here’s a simple solution. Or at least a simple solution if you already have SSH access to a host in the country you want to appear to be coming from.

First, from the command line on your local computer:

ssh -Nf -D 8080 username@example.com

Replace username@example.com with your username and host name of the remote host you’re going to use, the one that’s in Moldova or Berlin or wherever you need to virtually need to appear to be at.

Next, in Firefox, call up the Preferences dialog, and then navigate to Advanced | Network | Connection Settings, select Manual proxy configuration and in the SOCKS Host field enter localhost as the hostname and 8080 as the port number.

That’s it. You should appear to the world at large as though you are browsing the web from the remote host to connected to via SSH. You can test this by visiting WhatIsMyIP.com, which will report your IP address back to you (it should be the IP of your remote host, not of your local machine).

Comments

Peter Rukavina's picture
Peter Rukavina on September 22, 2011 - 19:16 Permalink

I can rest easy now knowing that you’ll have full access to streaming Beachcombers reruns while you’re in France…

Jason's picture
Jason on September 23, 2011 - 18:08 Permalink

This is great Peter. I assume to switch it back you just ssh to your normal provider when you’re done?

Ken's picture
Ken on September 24, 2011 - 00:13 Permalink

I tried to use my Godaddy.com hosting, and after an exciting phone call from a robo-voice with my PIN my SSH worked! My MacBook happily made the connection in terminal, and I set my proxy (thx for the screenshot). However when I try to browse I get an error: channel 2: open failed: administratively prohibited: open failed.
Can you recommend a US hosting service that this is known to work on? In fact could you recommend a non godaddy hosting site? Thanks for this tip, I learned from it.

Dan Misener's picture
Dan Misener on December 29, 2011 - 07:35 Permalink

Here’s something SOCKS-related that I didn’t know until recently, via the folks at Cloak:

SOCKS on OS X is effectively a second-class citizen. Sure, you configure your SOCKS proxy globally via the Network control panel, but it turns out that lots of important applications simply ignore it. For example, Apple’s own built-in Mail.app doesn’t honor system-wide SOCKS settings. That’s just the tip of the iceberg.
The result is that when you use SOCKS proxies, you get non-uniform security. Does the Twitter app honor SOCKS settings? Who knows.”

http://blog.getcloak.com/about…