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

Computers & Mobile

Jason @ Hackzine shows you how to remote desktop to a Windows server through a firewall with Putty –

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:
Configure a new ssh session for the ssh server that you have access to ( in this example).

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.

In the destination field, enter the ip address and RDC port for the firewalled machine, Ie. (3389 is what RDC listens on)
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 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.

6 thoughts on “HOW TO – Remote desktop to a Windows server through a firewall with Putty

  1. Matey-O says:

    Learn from my experience! Use your firewall to change ports. Port 22 is _well_known_ and frequently portscanned by the bad guys out there. If you happen to have _any_ account on the SSH server with a poor password (In my case user: heather password: heather) The will pwn you within the week…it took 36 hours in my case. Once they reach the linux box, they have access to _every_ networked device in your house. Got anything on your fileserver you want public? Got all your media backed up?

    So, I map 2200 on the firewall to 22 on the inside server…and I made sure the passwords were more stringent.

  2. RSBohn says:

    Great information. I can sure use this when I work from home.

  3. 0Troy says:

    A lot of people ignore SSH’s tunneling ability. It’s free, encrypted, and fast.

    Nuts to VPNs!

Comments are closed.

Discuss this article with the rest of the community on our Discord server!

current: @adafruit - previous: MAKE, popular science, hackaday, engadget, fallon, braincraft ... howtoons, 2600...

View more articles by Phillip Torrone