Set up a Windows SSH tunnel in 10 minutes or less

Here are step-by-step instructions for setting up a quick and dirty SSH tunnel to another network. This gives you the ability to connect to any machine and port that the remote machine has access to. The process is so simple, it should take you less than 10 minutes.

Why would you want to do this? Well, it’s a pretty slick way to connect to a remote machine on a single port and have access to all of the network resources of that machine. Your connection acts like it’s originating from the server. As a test, I set it up on my development computer running Visual Studio. Visual Studio runs web projects in a special web server that is only accessible from that machine. Using SSH, I was able to make it accessible to anyone on my network using my computer as a gateway.

SSH Diagram

In this example, we’re going to be using two free pieces of software. On the server, we’re going to use a version of OpenSSH that uses a stripped down version of Cygwin to run on Windows. On the client, we’re going to use Putty.

The first step is to download and install both programs. Here are the links to the download pages for each product:

On your the server, where OpenSSH was installed, we need to run a couple of quick commands at the command line (go to start->run and type "cmd"):

  • mkgroup -l >> ..\etc\group
  • mkpasswd -l >> ..\etc\passwd
  • net start opensshd

You’re now running an SSH server! Now we can configure the client (Putty).

Open up Putty. It doesn’t require installation, so you can simply double-click on the executable. In the tree on the left, navigate to Connection->SSH->Tunnels. We’re going to add a list of local ports that will be routed to machines that the server has access to. For example, if we want to access remote desktop on the remote machine, we can put a destination of 127.0.0.1, and a port of 3386. The source port is the port that we’ll connect to on our machine. Remember to click "Add" when adding a forwarded port.

SSH Tunnels in Putty

You should end up with something like this. Now, go to the "Session" section in putty. Enter the host name of the server you want to SSH into. Then, select "SSH" as the connection type. Then press "Open". You’ll be prompted for a username and password, which should be an account on the server you’re connecting to.

Putty Host Name Screen

The beauty of this is that you don’t have to set up the port list on the server, it’s all configured on the client. You can even let computers connect to your computer and have them be routed to the remote machine.

Hopefully that is enough information to get you started. I’m no SSH expert, but it was pretty easy to get set up when doing it this way.

Kick It!

14 Comments so far »

  1. Sooner Al said,

    Wrote on September 8, 2008 @ 5:20 am

    Please note the OpenSSH for Windows package you point to has *NOT* been updated in four (4) years. A better choice, IMHO, is the copSSH package that is actively maintained and updated as OpenSSH/OpenSSL/cygwin are updated.

    http://www.itefix.no/i2/node/27

  2. superjason said,

    Wrote on September 18, 2008 @ 2:34 pm

    Thanks! I game copSSH a try like you suggested and it worked very well.

  3. Raden Payas said,

    Wrote on May 24, 2009 @ 6:52 am

    Hi Admin,

    Will this tutorial help me with my closed port 25 problem?

    Thanks

  4. Nnyan said,

    Wrote on December 28, 2009 @ 1:25 pm

    Why even install OpenSSH on your windows box? All you need is Putty. Under Connection –> SSH –> Tunnels do the following:

    - Check both boxes under Port Forwarding
    - Add a new Forwarded Port
    Source Port: Anything you want ex: 1080
    Destination: Your remote server with SSH running
    Checks: Dynamic and Auto

    Then you set your browser to use SOCKS5/Localhost/your selected port

    OR just download MyEnTunnel and Plink to do the same thing as above.

  5. andersell said,

    Wrote on January 21, 2010 @ 3:15 am

    Use ssh tunnel easy setup a ssh tunnel only one minutes. Get it from http://www.networktunnel.net

  6. toba said,

    Wrote on February 24, 2010 @ 4:46 pm

    Nnyan said:
    “Why even install OpenSSH on your windows box?….

    Destination: Your remote server with SSH running”

    …!!!

  7. SSH Forwarding sous Windows - K'ao's Universe said,

    Wrote on March 8, 2010 @ 2:11 pm

  8. D2vin said,

    Wrote on May 20, 2010 @ 6:26 am

    Hello,

    i am trying to follow your instructions,
    but i find the tutorial incomplete

    1)you dont mention that you have to navigate to the bin directory of OpenSSH and then type the commands

    2)Configuring the Client: you dont mention anything about the Host Name? What do i type there? It here that im stuck!

    3)Putty -> Connection -> Data: what username to use to login in the server? what about the password? Is there a specific format?
    ———————————

    I really need to set this up in order to bypass download limitations, please help me

    thanks
    D2vin

  9. Banser step said,

    Wrote on July 15, 2010 @ 10:12 am

    I try ssh tunnel easy, working and easy, thanks.

  10. Help a bit said,

    Wrote on August 17, 2010 @ 11:26 pm

    hi can you help me? i do as you say but then it tells me to use the -d command and then when i do it tells me cannot get pdc, code=2453

  11. Alya from pillows for pregnancy said,

    Wrote on September 22, 2010 @ 4:43 am

    Hi, if I am using windows 7, is this method still can be implement? Thanks..

  12. me said,

    Wrote on October 6, 2010 @ 11:16 pm

    I downloaded the ssh files.
    It’s all .nsi file’s though and I don’t know how to open them

  13. موتور جستجوی تالارگفتمان های فارسی » Blog Archive » Open ssh on windows said,

    Wrote on February 19, 2011 @ 4:52 pm

  14. hamachi intranet connection - Admins Goodies said,

    Wrote on August 9, 2011 @ 3:00 pm

    [...] be to use an SSH tunnel to tunnel your local webserver port (80 by default) to the remote PCs (see here for Win, or here for [...]

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: