Rdp stands for Remote Desktop Protocol. Rdp is a Microsoft protocol to login remotely to windows.

Xrdp is an open source implementation of Rdp protocol. Xrdp gives you a graphical interface remotely.

Install Desktop Environment

Let us check first if Xrdp is already installed.

sudo systemctl status xrdp
Unit xrdp.service could not be found.

To install run following command...

sudo apt install xrdp -y

Check the status again...

sudo systemctl status xrdp

xrdp.service - xrdp daemon
   Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-08-19 20:33:50 UTC; 12s ago

Next we need to add xrdp to the ssl-cert group so that it can access  /etc/ssl/private/ssl-cert-snakeoil.key

sudo adduser xrdp ssl-cert  

Now if you run groups ssl-cert, you should see following...

groups xrdp
xrdp : xrdp ssl-cert

Configure Xrdp

Xrdp is in following directories...

whereis xrdp.ini

xrdp: /usr/sbin/xrdp /usr/lib/x86_64-linux-gnu/xrdp /etc/xrdp /usr/share/xrdp /usr/share/man/man8/xrdp.8.gz

Out of all the above /etc/xrdp/xrdp.ini is the most important one. Whenever you make changes to the xrdp.ini file, you will have to restart the xrdp server.

sudo systemctl restart xrdp

By default xrdp listens on port 3389. You can check listening port using the lsof command...

lsof -i :3389
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
xrdp    23164 xrdp   11u  IPv6 236866      0t0  TCP *:3389 (LISTEN)

Therefore we need to open up the port 3389.

sudo ufw allow 3389

Connect to the Xrdp Server

Now go to your PC and search for "Remote Desktop Connection" and enter the IP of the Ubuntu Server, username and password. You should be able to connect to Ubuntu server using rdp.