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 ..)


You might also like

If you like this post then please subscribe to my full RSS feed. You can also click here to subscribe by email. There are also my fabulous photos to explore too!

"How to use ssh as a proxy server", 4 out of 5 based on 7 ratings.

19 thoughts on “How to use ssh as a proxy server


  1. Remeber to also check if the application can proxy dns requests over the SOCKS5 connection. Firefox can and many others can too. Proxing the dns requests will allow one to better anonymize traffic and allow you to check remote dns servers for updates or problems. Thanks for the positive review.

    Proxy Firefox through a SSH tunnel
    http://calomel.org/firefox_ssh_proxy.html


  2. Can you use this with the -p option if you are using a non-standard port? I tried it and all I get is a blank page when accessing websites.


  3. can you help write a proxy for my website so i can use it perferably PHP using cURL or something fast enough to load pages in 1 min or less…
    thanx
    dont email me it doesnt work just reply on my myspace …..


  4. ok look my there is this super blocker on the local computers called barracuda. and its kickin my ass. ive gotten around the last 3 or 4 blockers with some home made proxies and firewalls. but this 1 is straight kickin it. i cant even download my stuff to the computer cuase it says proxy or firewall… let me no if ya got anything. thanks john’


  5. I have been playing with this for various reasons and I noticed some of my equipment will only run over a http proxy.

    Any suggestions as to how I can plug a http proxy in front of the socks proxy…

    Isn’t ssh nice !


  6. This just makes a SOCKS proxy.
    how can i use it to make a http proxy …
    something like some applications such as ultrasurf or freegate or etc …


  7. iranian:
    You can use a software called privoxy to convert SOCKS proxy to a http proxy.


  8. I use ProxyCap (http:/www.proxycap.com/). It will automatically create the ssh tunnel and will redirect my apps to this tunnel.

Leave a Reply

Loading Facebook Comments ...