RDP via SSH tunnel

Contents
Introduction
Connection scheme
Steps.
SSH setup server
SSH setup client
Port transfer on the router
Opening of the session by the client
Setting up RDP on server
Connection to RDP with client
Port transfer in Putty - Putty Tunnel
Similar articles

Introduction

The goal is to securely connect to the server behind the router from an external network.

Make sure you understand how to create the simplest SSH tunnel, for example, such as here

Configuration of connection by rdp via SSH image from www.aredel.com
Normal laptops on the site - OLDI

Creating a tunnel is a rather time-consuming task, consisting of conditionally six parts.

  1. Setting up an SSH server
  2. Setting up SSH client
  3. Port transfer on the router
  4. Opening of the session by the client
  5. Setting up RDP on the server
  6. RDP connection with the client

You will need a router, putty and freesshd.

The router must support Port Forwarding You can buy online in stores:

1. Setting up an SSH server

1.01 Install and launch freeSSHd. Create a key so that the server does not swear, then change it to a new key.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Installation of freeSSHd
Creation of the key

1.02) There are nuances here, at the moment I prefer to choose.No."

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Installation of freeSSHd
System Service

1.03) The freeSSHd icon appears in the tray, select Settings

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.04) Of course, you need to give permission to the firewall.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.05) In the Authentication section, allow only key access

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.06) Go to the Users menu

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.07) Add a new user

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.08) View after addition

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.09) Run it on the server. PuTTYgen

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.10) Generate a pair of keys

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.11 The public key that will remain on the server must be copied from the top window.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.12) Insert the public key in the text editor, check that it was in one line and began with the word ssh-rsa

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.13) To save the key as a text file, the name must be the same as the user who was previously created (in our case sini).

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.14) Remove the extension

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.15) Agree.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.16) Show me. freeSSHd keyway

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

1.17) Save the private key, which will then need to be transferred to the client computer As a result of previous manipulations, we have a running SSH server and a pair of keys.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

2. SSH configuration on the client computer

2.18) On the client computer, you need to put the private key in a folder previously created for it.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

2.19) On the client, we run PuTTY and create a connection called sini. In the Host Name (or IP address) field, we specify the desired external ip server, since it is behind the router, it will be the ip router. We change port to 443 or something else, only meaningfully.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

2.20) In the Auth field, indicate the path to the private key

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

2.21) Select the key

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

2.22) Building a tunnel

port 3389 This is a standard port for RDP. We will use port 3391 on the client as the «entrance» to the tunnel.

The image below shows what we put in line. Local port 3391 port 3389 on IP 192.168.0. 101

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

2.23) Remain the session. In the Not Name field, write the IP server.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

At this stage, we have prepared an SSH connection, which the server listens to on 443 ports.

Just in case, I specify that in this example, the IP server in the local network 192.168.0. 101

The external IP server is the IP router. In the picture it is smeared, in your case it will be yours. external IP, which is like 78.47. 141.187

Configuration of connection by rdp via SSH image from www.aredel.com
If you want a normal laptop, and not as I have in the picture – go to the site. OLDI
Banner image

Port transfer on the router

3.20) Set the link on the router MAC server address to an IP address

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

3.21) We explain to the router that when there is a request for port 443, you need to transfer it to the server. (Do Port Forwarding - Port forwarding)

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

Putty on the client

4.22) Opening of the session

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

Setting up RDP - On the server

5.23) Create a user sini

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

5.24) We must create a password.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

5.25) Allow access by RDP

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

5.27) Add Blue to the list of RDP users

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com
Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

Setting up RDP - On the client

6.28) Start on the mstsc client (first you need to open the SSH tunnel). If it is open, check whether the session is over.

To prevent anyone from working, you can check if someone is connected. To the computer or not. This can be done with the help of PSTools instruction here

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

6.29) Connect to localhost:3391

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

Enter the password.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

6.30) We agree.

Connect to a remote RDP desktop via the SSH tunnel image from www.aredel.com

Note for OpenBSD

We have a computer in St. Petersburg (PC SPb), a server on OpenBSD in MSK (SRV MSK) and a local computer, connected to the server in MSC (PC MSK). The goal is to connect with PC SPb to PC MSK via ssh tunnel via rdp using putty from Windows.

You need to do the same as described in the link, but in the first picture note

Local ports accept connections from other hosts

The source port can be selected by any of the free ones, such as 6789. In the field Destination point out

Local ip PC MSK:3389

When connecting by RDP (last picture) you can specify

127.0.0.2:6789

Article author: Andrei Olegovich

Related articles
RDP: Remote desktop
SSH tunnel for RDP
Network

Search this site

Subscribe to Telegram channel @aofeed to follow new articles and updates to old ones

Go to channel

@aofeed

Ask a question in the Telegram group

@aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: