Remote Desktop Protocol (RDP) is a proprietary protocol developed by Microsoft which provides a user with a graphical interface to connect to another computer over a network connection. The user employs RDP client software for this purpose, while the other computer must run RDP server software. Clients exist for most versions of Microsoft Windows (including Windows Mobile), Linux, Unix, macOS, iOS, Android, and other operating systems. RDP servers are built into Windows operating systems; an RDP server for Unix and OS X also exists. By default, the server listens on TCP port 3389 and UDP port 3389.
RDP is very handy especially to be able to copy paste things in and out of virtualized hosts or to establish Keyboard Mouse and Video connection at a desired screen resolution. The RDP protocol implementations allow us to establish remote desktop connections from Windows or Linux hosts, to Windows or Linux hosts. We will split this tutorial in 3 parts:
First of all, in order to connect to a windows host via RDP, we need to enable RDP on that host. To do so we need to enable Remote Desktop:
Then enable RDP like so:
Once that's done, you know that your windows host has it's port 3389 opened for RDP connections, you simply need to know what it's IP is:
Now with this we know that our Windows' host IP is 10.0.0.203 now if you want to connect to it from a Linux host, i highly recommend you use remmina, this is a fantastic tool to primarily handle RDP but also other protocols.
root@debian-pgadmin4:~# apt search remmina
Sorting... Done
Full Text Search... Done
remmina/stable 1.3.3+dfsg-2 amd64
GTK+ Remote Desktop Client
root@debian-pgadmin4:~# apt install remmina -y
[ 10.0.0.10/16 ] [ /dev/pts/39 ] [Github/blog/servers]
→ pacman -Ss remmina
community/remmina 1:1.4.12-1 [installed]
remote desktop client written in GTK+
[ 10.0.0.10/16 ] [ /dev/pts/39 ] [Github/blog/servers]
→ pacman -S remmina
Remmina should be there on debian and arch based distributions, once installed it will look like so:
Here we supply the ip address of our windows host, the username we want to login as, it's password, and if it is connected to windows Active Directory, you can specify the Domain name (highlighted in green) In the advanced options you can also tweak a few other things, but for now hit 'save and connect' and you will get the following:
And that's it ! You have been able to login and connect to your windows host on the local network. Now you can hit LCTRL to enable the keyboard event grabbing, LCTRL+F to go fullscreen and more.
Now that we have Remmina installed on our Linux Host machine, Let's say we have access via ssh to a remote linux host:
[ 10.0.0.10/16 ] [ /dev/pts/3 ] [Github/blog/servers]
→ ssh root@10.0.0.112
root@10.0.0.112's password:
Linux debian-pgadmin 5.4.106-1-pve #1 SMP PVE 5.4.106-1 (Fri, 19 Mar 2021 11:08:47 +0100) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Apr 3 17:02:12 2021 from 10.0.0.10
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@debian-pgadmin:~# ip a | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 10.0.0.112/16 brd 10.0.255.255 scope global eth0
inet6 fe80::68b5:5ff:fe35:dd26/64 scope link
From here we can setup a RDP connection to be able to spawn a graphical connection thanks to the Xrdp package:
root@debian-pgadmin:~# apt search xrdp
Sorting... Done
Full Text Search... Done
xorgxrdp/stable 1:0.2.9-1 amd64
Remote Desktop Protocol (RDP) modules for X.org
xrdp/stable,stable 0.9.9-1+deb10u1 amd64
Remote Desktop Protocol (RDP) server
root@debian-pgadmin:~# apt install xrdp -y
Hit enter and let it install. After that we will start the rdp service using systemctl:
root@debian-pgadmin:~# systemctl enable --now xrdp
root@debian-pgadmin:~# systemctl status xrdp
* xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-04-03 17:55:55 UTC; 2min 29s ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Main PID: 32082 (xrdp)
Tasks: 1 (limit: 7372)
Memory: 1.2M
CGroup: /system.slice/xrdp.service
`-32082 /usr/sbin/xrdp
Apr 03 17:55:55 debian-pgadmin systemd[1]: Started xrdp daemon.
Apr 03 17:55:55 debian-pgadmin systemd[1]: /lib/systemd/system/xrdp.service:8: PIDFile= references path below legacy directory /var/run/, updating /var/run/xrdp/xrdp.pid
Apr 03 17:55:56 debian-pgadmin xrdp[32082]: (32082)(140173514213184)[INFO ] starting xrdp with pid 32082
Apr 03 17:55:56 debian-pgadmin xrdp[32082]: (32082)(140173514213184)[INFO ] listening to port 3389 on 0.0.0.0
Apr 03 17:55:56 debian-pgadmin systemd[1]: /lib/systemd/system/xrdp.service:8: PIDFile= references path below legacy directory /var/run/, updating /var/run/xrdp/xrdp.pid
Apr 03 17:55:57 debian-pgadmin systemd[1]: /lib/systemd/system/xrdp.service:8: PIDFile= references path below legacy directory /var/run/, updating /var/run/xrdp/xrdp.pid
Apr 03 17:55:57 debian-pgadmin systemd[1]: /lib/systemd/system/xrdp.service:8: PIDFile= references path below legacy directory /var/run/, updating /var/run/xrdp/xrdp.pid
Apr 03 17:58:14 debian-pgadmin systemd[1]: /lib/systemd/system/xrdp.service:8: PIDFile= references path below legacy directory /var/run/, updating /var/run/xrdp/xrdp.pid
Apr 03 17:58:15 debian-pgadmin systemd[1]: /lib/systemd/system/xrdp.service:8: PIDFile= references path below legacy directory /var/run/, updating /var/run/xrdp/xrdp.pid
Apr 03 17:58:15 debian-pgadmin systemd[1]: /lib/systemd/system/xrdp.service:8: PIDFile= references path below legacy directory /var/run/, updating /var/run/xrdp/xrdp.pid
root@debian-pgadmin:~#
And that's it! now we should be able to connect to it:
[ 10.0.0.10/16 ] [ /dev/pts/31 ] [Github/blog/servers]
→ nmap -p3389 10.0.0.112
Starting Nmap 7.91 ( https://nmap.org ) at 2021-04-03 19:59 CEST
Nmap scan report for 10.0.0.112
Host is up (0.00064s latency).
PORT STATE SERVICE
3389/tcp open ms-wbt-server
Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
As you can see above, the port is supposed to be opened and ready to recieve our connections. Let's move over to remmina:
Hit save and connect:
This is a very minimal debian server, so if you didn't install any desktop environnement on it by default it will leave you in a TTY. let's see how this looks like when we install a Desktop Environnement like XFCE4 and lightdm:
root@debian-pgadmin:~# apt install lightdm xfce4
root@debian-pgadmin:~# systemctl enable lightdm
root@debian-pgadmin:~# reboot now
Once installed we can connect via RDP again and see what happens:
And that's it! We have been able to connect to our debian host via RDP and get a graphical interface.
On windows' side, we don't need to install anything. the RDP protocol is built in to windows 10 as you can see here:
WIN+R mstsc
let's try to connect to our linux host at 10.0.0.112 as the root user:
Here we're greeted by xorg's login screen, just use your root password there and login:
It's that easy! This goes without saying but RDP was originally made for Windows -> Windows connections, so here's an example using my Windows Server 2019 VM at the 10.0.0.204 ip:
WIN+R mstsc
And that's it! We have been able to establish a Windows-Windows RDP connection.
Some Address 67120,
Duttlenheim, France.
This cute theme was created to showcase your work in a simple way. Use it wisely.