Bypassing geo-restrictions with ssh

ssh is an amazing Unix tool. One of its many powers: bypassing geo-restrictions by acting as a forward proxy.

Setting up a forward proxy with ssh

You will need access to a remote server to do this. I already have a few servers I rent in different regions to host a variety of websites; the ability to use these as proxies is pure bonus!

Without further ado here’s the single ssh command you need to create a proxy:

$ ssh -D 8123 -f -C -q -N user@host

Let’s break down the ssh options (extracted from the man page):

In practice I have two aliases to toggle proxying on and off easily:

alias proxyon='ssh -D 8123 -f -C -q -N user@host'
alias proxyoff='killall -v ssh'

Browsing with a proxy

Once you have a local port set up to forward traffic onto a remote host, browsing the web using it is simple.

In Firefox, go to Preferences > Network Settings > Settings > Manual Proxy Configuration. Then fill in “localhost” and “8123”. Click OK and you’re good to go!

Firefox Preferences

Chrome (on MacOSX) relies on system-wide proxy settings: System Preferences > Network > Advanced > Proxies. Tick “SOCKS Proxy” and fill in “localhost” and “8123”.

System Preferences

…that’s all there is to it! Goodbye geo-restrictions.