Remote Desktop Protocol (RDP) is a protocol developed by Microsoft that allows graphical connection to a remote computer and sharing of resources. Being able to access RDP over the internet when you’re away from home is good, but securing the connection is the way to go.


By using an SSH server, you will be able to access RDP over the internet securely and access shared resources located in a foreign country.


Prerequisites
Before trying this tutorial, you should have the following:
  • Two devices with Windows 10 installed and one of them with a version other than Windows 10 home.
  • The PC you want to connect to must have remote connections enabled.
  • An SSH server on the local network to which you want to connect.
  • Have plink or putty installed on the computer you will be using the remote desktop client.

Step 1: Configuring an SSH tunnel using Plink

Open command prompt and type: plink -ssh -i ssh-private-key -L 127.0.0.1:Local-Port-Forward-on-rdp-client:local-ip-address-of-the-remote-pc:listening-rdp-port-on-the-remote-computer -P port-of-ssh-server user@ssh-server-ip-address-or-ssh-server-hostname

plink -ssh -i amazonkey.ppk -L 127.0.0.1:3390:172.16.40.77:3389 -P 31587 root@htopskills.com

When you have finished writing the information, press Enter.


If this is not the first time you log on to this remote computer and you see a different key fingerprint, there’s a big chance it’s a man in the middle attack SSH.


If everything is correct, press y to store the key in cache. When you see on the screen “press return to begin session”, press enter



Step 2: Connecting to Remote Desktop

Now, you are connected to the SSH server and a local port to connect to the remote PC is listening on port 3390 on your windows computer.


Go to search and type remote desktop,
Choose Remote Desktop Connection.


In computer, type localhost and the local port you just setup for the remote desktop.

Click connect to access the remote computer who is running the remote desktop server.


Enter the user name and password of the remote computer.
Click OK.


If this is the first time that you are connecting to the remote computer, the message below is normal; And there is no risk for “man in the middle attack rdp” over the internet because you are already connected to the SSH server.
Click Yes to continue.


If someone is already connected to the computer you will see a message like the one below.


Below in the picture is the Windows 10 desktop of the computer located in a foreign country.


Video to show you how to remote desktop tunnelling through SSH



What To Read Next