SSH Tunneling on Windows Using PuTTY

Imagine if you will; you are at work or school and you need to access a site, but its blocked. So being the tech savvy person you are you try a proxy tunnel and that too is blocked.  What do you do?

You create an SSH tunnel proxy on your own machine!

First off, in order to do any of this regardless of your Operating System you need:

  1. an SSH Server
  2. a knowledge of how to configure your computer / browser to use the proxy
  3. some knowledge of writing scripts (optional if you want to run stuff when you startup your computer)

 

Now, if you are on linux or mac it is simple as opening the terminal and running:

Then just point your browser or computer system network settings over to 127.0.0.1 port 55555 it will look like this (on firefox):

2013-05-16 15_25_03-Connection Settings

However, if you are an unfortunate Windows OS user, your situation isn’t as easy. Sure, you could install Cygwin to get ssh on windows; but that just takes a lot of time and configuring and who has the patience for that?! So instead you use the easiest SSH tool for windows: PuTTY.

PuTTY is a simple executable file that lets you connect to ssh servers easily and effectively. It also allows you to store “Sessions” with special settings for the servers you connect to, but all that can be looked at on your own; now back to the topic at hand.

In order to make connecting to your server as simple as possible I created a script that can be ran. You can even edit this script to include some other programs you want to “auto-launch” once you have the proxy up and running.

(take care to replace all the necessary variables in the objShell.Run command i.e. Paths, Passwords, Users, etc.)

now copy this code and paste it into a file and name the file WhateverNameYouWant.vbs (the .vbs portion is crucial as it is how the script will be able to execute). Execute the script and then you’re almost done. All that is left is to configure whatever program (as long as it supports a SOCKS5 proxy) to use the proxy.  Again to do it on firefox:

2013-05-16 15_25_03-Connection Settings

Make sure to leave PuTTY up and running, if you close it out it causes your proxy to shutdown as well.

NOTE: configuring your browser to use the proxy in the way shown above will cause all your traffic all the time to be sent through the proxy.  If you want a way to toggle between proxy and no proxy install an addon onto the browser (I recommend FoxyProxy, it’s compatible with both Firefox and Chrome).

 

I hope you have enjoyed this little tutorial and if you have any questions leave a comment down below.

One Thought on “SSH Tunneling on Windows Using PuTTY

  1. Valentin on November 14, 2017 at 10:38 PM said:

    Don Oerkfitz your script works perfectly but you can simplify it even further without the need of VB script. You can use a batch file (file.bat) having this simple line:

    Path\To\putty.exe -ssh -D 55555 user@your.ssh.server -pw passwordHere

    Kind regards,
    Valentin

Leave a Reply

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

Are you an intelligent human being? * Time limit is exhausted. Please reload CAPTCHA.

Post Navigation