Home » Software » SSH » RDP to a host behind a firewall

RDP to a host behind a firewall

RDP to a host behind a firewallHere is a quick tutorial on how to RDP to a host behind a firewall.

RDP to a host behind a firewall

Prerequisites:

  • Linux firewall or
  • SSH access to a host behind your firewall (some port forwarding through the firewall, I’d imagine)
  • We are using www.hostname.com as the IP/Hostname of your remote firewall
  • We are using the example IP of 192.168.1.23 for our Windows server behind our Firewall on a private LAN. Since this IP will most likely NOT be correct for you, please use the correct IP address.

Linux
This command forwards port 3390/tcp on your local PC to 3389/tcp on 192.168.1.23. This is dependant upon your firewall accepting ssh on port 22 or have port 22 forwarded to a host running an ssh server behind your firewall.

ssh -l username www.hostname.com -L 3390:192.168.1.23:3389

Now you have a shell open to your linux box behind the firewall. You must keep this open to keep the ssh tunnel open to your Windows PC.

Now on the linux workstation you are on, you’ll need to open another terminal
rdesktop -g 1024×768 -u username 127.0.0.1:3390 &

or
rdesktop -g 1024×768 -u username localhost:3390 &

Windows

This same thing can be done with Putty on a Windows PC

  • Session Tab
    Enter the hostname or IP address of your firewall in the HOSTNAME box
  • Connections>SSH>Tunnels tab
    Under “Add new Forwarded port Section
    Source port 3390
    Destination 192.168.1.23:3389
    Click the Add button, once you click add this information should appear in “Forwarded Ports” box.
    Click the Open button at the bottom of the Putty window to open the connection. NOTE: You may want to click back onto the Session tab and Save this info if you plan on doing this often.

Now you can run the RDP (remote desktop) client on windows to host localhost:3390, this will connect you to your Windows server behind your firewall via an encrypted SSH tunnel.


As an Amazon Associate I earn from qualifying purchases. Read our Privacy Policy for more info.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.