How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04

How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04

Xrdp is a free and open-source software implemented to connect remotely. It is implemented in Microsoft Remote Desktop Protocol system.

You can connect remotely with RDP; you can log in to the remote machine and create a real desktop session, a replica of the local machine you log into a local machine.

Installing Desktop Environment

How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04

Xrdp is a free and open-source software implemented to connect remotely. It is implemented in Microsoft Remote Desktop Protocol system.

You can connect remotely with RDP; you can log in to the remote machine and create a real desktop session, a replica of the local machine you log into a local machine.

Installing Desktop Environment

Ubuntu servers do not have a desktop environment installed by default.

There are two common desktop environment for Ubuntu; 

Gnome,Xubuntu and Xfce. They are both a lightweight desktop environment, yet fast and reliable. 

Type one of the commands below to install the desktop environment of your choice:

  • Install Gnome
  • sudo apt updates 
  • sudo apt install ubuntu-desktop
  • Install Xfce:
  • sudo apt update
  • sudo apt install Xubuntu-desktop

Depending on your machine, downloading and installing GUI take some time.

Type the following command to install it, run:

sudo apt install xrdp

Xrdp service will automatically start once the installation is complete

Verify it by typing:

sudo systemctl status xrdp

The output:

  …

Type the following command to “add the xrdp user to the group”:

sudo adduser xrdp SSL-cert  

Restart the Xrdp service for changes to take effect:

sudo systemctl restart xrdp

Congratulations!!! Xrdp has been installed on your Ubuntu server.

Configuring Firewall

The Xrdp daemon listens on port 3389. If firewall on your Ubuntu server is active, you’ll need to open the Xrdp port.

To grant access to the Xrdp server from a specific IP address, for example, 192.168.0.6/24, type the following command:

sudo ufw allow from 192.168.33.0/24 to any port 3389

If you want to grant access from anywhere (not encouraged due to  security reasons), run:

sudo ufw allow 3389

For security, you can set up Xrdp to listen only to the localhost and create an SSH tunnel that secures the  traffic from your local machine on port 3389 to the server on the same port.

Connecting to the Xrdp Server

Connecting to  your Xrdp server, open your Xrdp client and connect to the server.

If you have a Windows machine, use the default RDP client. Type “rdp” in the search bar and click on “Remote Desktop Connection”. This opens up the RDP client, enter the remote server IP address and click “Connect”.

On the login screen,input your username and password and click “OK”.

Once logged in, the default Gnome or Xfce desktop output:

Now start interacting with the remote desktop from your local machine 

If you are running macOS, you can install the Microsoft Remote Desktop application from the Mac App Store. Linux users can use an RDP client such as Vinagre or Remmina.

Conclusion

Configuring a remote desktop allows you to manage your Ubuntu 20.04 server from your local machine with a graphical interface.