HOW TO: Remote desktop to a Windows server through a firewall with Putty

puttytunnel_20070502.jpg
Here's a common scenario: you need to make an emergency remote desktop connection to an XP server at work, but you're at home and the server is behind a firewall that blocks RDC connections.

In a nutshell, ssh tunneling allows you to connect to a port on another machine by forwarding traffic through an intermediary ssh server. Using an ssh tunnel, if you have access to an ssh server behind the firewall, you can connect to services on other machines behind the firewall, including remote desktop services.

Using Putty (a rockstar ssh client for Windows), you can easily set up a tunnel for accessing RDC on your firewalled server:

  1. Configure a new ssh session for the ssh server that you have access to (66.35.250.203 in this example).
  2. In the connection/ssh/tunnels menu, add a new forwarded port. You'll need to set up a port on your own machine (this will be the virtual, forwarded connection to the remote RDC server), so use something unused, like 3390.
  3. In the destination field, enter the ip address and RDC port for the firewalled machine, Ie. 192.168.0.5:3389 (3389 is what RDC listens on)
  4. Now save your session and connect to the SSH server

At this point, you can connect to the remote server's RDC port via your own machine's port 3390. Everything that comes in and out of localhost:3390 will be transparently whisked away over the ssh connection, through the intermediary machine, to your destination server's port 3389. So instead of entering 192.168.0.5:3389 for your destination server in the remote desktop client, enter localhost:3390. It will go right through the firewall.

Breaking Firewalls with OpenSSH and PuTTY (read this)- Link.
Putty SSH Client for Windows - Link.


Recent Entries

Comments

Oldest comments listed first.

Posted by: MattWB on May 2, 2007 at 11:30 PM

I've been doing this for years with my Linux server, Smoothwall firewall router, and XP desktop and it works great. I suggest that you move SSH off of port 22 if you can, it will decrease the number of bots that try to brute force your host. Attacks against my SSH server dropped from about 400/day to maybe 1/month after I set it to listen on a non-standard port. Also be sure to disallow root logins and only allow SSH2 traffic in your sshd_config.


Posted by: JMVL on May 30, 2007 at 8:59 AM

I agree...changing the port is a much better strategy for securing the tunnel.

Matt, have you ever used this same setup to then do revierse or server-to-client port forwarding?

i.e.- My tunnel is established from work-to-home over SSH via putty. I then want to be able to connect from my home-to-work back over the established tunnel with RDP. I toyed around with using the the remote Putty Port forwarding but could not seem to get this to work. Any experience with this?

Thanks


Posted by: Anonymous Coward on January 30, 2008 at 4:29 PM

Just for info, I've been doing this with Windows XP for years. If you try it with the standard RDP client in Vista, port 3390 doesn't work as it's apparently reserved for Windows Media Centre. If you try on 3390, you'll get an error from RDC saying you're trying to connect to your own computer which you're not allowed to do. Change the local port in PuTTY to 3391 and you're good to go using that port.


Leave a comment


Subscribe to MAKE!Subscribe to MAKE Magazine!

Subscribe today, save 42% and get web access to MAKE free. MAKE Digital Edition is available only to subscribers.

$34.95 / 1 year
(4 Quarterly Issues)

Subscribe now


Void your warranty, violate a user agreement, fry a circuit, blow a fuse, poke an eye out. Make: The risk-takers, the doers, the makers of things... Welcome to Make: Online!


CRAFT Maker Shed Maker Faire MAKE television
Holiday Gift Guides from MAKE
Gifts for Dads
Science and Chemistry
Gifts Under $20
More guides: Santa Claus Machines, Geek Toys for Grown Up Girls & Boys


Check out all of the episodes of Make: television

Alex Rider Dream Gadget Contest
Make: Science Room

Connect with MAKE

Be a MAKE fan on Facebook MAKE on Facebook
Visit our Facebook page and become a fan of MAKE!
MAKE on Twitter MAKE on Twitter
Follow our MAKE tweets!
MAKE Flickr Pool MAKE on Flickr
Join our MAKE Flickr Pool!
    make_tips on Twitter




    Maker SHED

    Advertise here with FM.

    Why advertise on MAKE?
    Read what folks are saying about us!

    Click here to advertise on MAKE!



    Subscribe to MAKE Magazine!

    Make: Online authors!

    Gareth BranwynGareth Branwyn
    Senior Editor


    Phillip TorronePhillip Torrone
    Senior Editor
    | AIM | Twitter


    Becky SternBecky Stern
    Associate Editor
    | AIM | Twitter


    Marc de VinckMarc de Vinck
    Contributing Writer
    | AIM | Twitter


    John ParkJohn Park
    Contributing Writer
    | Twitter


    Sean RaganSean Ragan
    Contributing Writer
    | Twitter


    Matt MetsMatt Mets
    Contributing Writer
    | AIM | Twitter


    Dale DoughertyDale Dougherty
    Editor & Publisher
    | Twitter


    Shawn ConnallyShawn Connally
    Managing Editor
    | Twitter


    Goli MohammadiGoli Mohammadi
    Associate Managing Editor

    Kip KayKip Kay
    Weekend Projects
    | AIM | Twitter


    Collin CunninghamCollin Cunningham
    Contributing Writer
    | AIM | Twitter

    Adam FlahertyAdam Flaherty
    Contributing Writer
    | AIM | Twitter



    More contributors: Mark Frauenfelder (Editor-in-Chief, MAKE magazine), Kipp Bradford (Technical Consultant/Writer), Chris Connors (Education), Diana Eng (Guest Author), Peter Horvath (Intern), Brian Jepson (O'Reilly Media), Robert Bruce Thompson (Science Room)

    Suggest a Site!

    Current Podcast

    itunesdl.gif Weekend Project: Beetlebot Simple robot from your parts bin that avoids obstacles. Thanks go to Jerome Demers for the original article in MAKE, Volume 12. To download the Beetlebot video, click here or subscribe in iTunes. Check out the complete Beetlebot article... More...

    Get the Make: Online sent via email
    Enter your email to receive Make: Online each day:



    MAKE Fascination video series brought to you by Dow

    Make: Education
    MAKE: en EspaƱol MAKE: Japan
    Important please read


    Subscribe to MAKE Magazine!

    Recent Posts from the Craft: Blog