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

How to Install XRDP Server (Remote Desktop) on Ubuntu 20.04. Xrdp is an open source implementation of the Microsoft RDP (Remote Desktop Protocol) server that allows you to remotely connect and control your Linux server from your Windows computer via any RDP client.

It allows you to take control of your Linux server, manage files, and run programs as if you were sitting in front of the physical system. This tutorial explains the steps for installing, configuring, and connecting to Ubuntu 20.04 with remote desktop clients on Windows.

What is XRDP Server

Xrdp Server is a remote desktop protocol (RDP) server that allows you to connect to your PC remotely, using the RDP protocol, as long as you have a broadband internet connection. It’s similar to VNC but with more security and speed.

It stands for X Remote Desktop Protocol, and it is an implementation of RDP (Remote Desktop Protocol). This RDP service provides connections between servers and clients over the Internet or any other TCP/IP network.

Xrdp uses the RDP server, rdesktop, xorg display server, or the Microsoft Remote Desktop Client. It is a fork of rdesktop, with added support for the DirectX rendering API (Direct3D) and GnuTLS TLS encryption. Xrdp uses xfreerdp to connect to Microsoft Windows servers.

This application allows you to connect to your desktop via RDP, VNC, or SSH protocols. The application also supports audio and video streaming, so you can watch movies on your computer from a remote location.

Xrdp is available for Windows and Linux users. It is useful when you want to access your Ubuntu desktop from home or office but don’t want to configure port forwarding etc. You can also use it to access other computers behind a firewall that are not accessible from outside.

Features of XRDP

Xrdp has several functions besides the ability to establish a graphical remote session between an Ubuntu and a Windows remote machine.

  • Not only does Xrdp offer graphics remoting, but it also supports auto redirection.
  • By default, RDP transport is secured with TLS.
  • Xrdp Server supports remote desktop features, such as multi monitor support and clipboard sharing.
  • It transfers in both directions, including bitmaps, files, and text.
  • It also aids in the mounting of the client’s local discs on a remote system, a process known as drive redirection.
  • As long as you use Xrdp for remote access on your system, there aren’t many security concerns.

It is vital to read about Azure RDS. Check out our template for the quickest and easiest way to use Azure RDS deployment template that fully sets up a remote desktop services farm.

Follow this post to learn how to install XRDP Server on Ubuntu 20.04.

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

Before we move on to the Xrdp Server installation, we need to make sure that all the prerequisites for the Xrdp are met and the system is ready for installation.

Update & Upgrade Your System

It is always recommended to update and upgrade your system before any installation to make sure all the installed packages in the system are of the latest version.

Use the following combined command to update and upgrade your system with a single command.

				
					sudo apt update 
sudo apt upgrade -y
				
			

Install a Desktop Environment With Tasksel Utility

When you install Ubuntu Server, it does not have a desktop environment installed. XRDP is designed to control only desktop systems. So, you will need to add a desktop environment to your system to use it.

One of the most useful utilities for installing desktop environments is Tasksel. Tasksel not only lets you install multiple packages but also installs the dependencies along with the selected packages.

This utility does not come by default in Ubuntu, but you can install it using the following command.

				
					sudo apt install tasksel -y
				
			

Output:

				
					Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfwupdplugin1 linux-headers-5.11.0-36-generic linux-hwe-5.11-headers-5.11.0-36
  linux-image-5.11.0-36-generic linux-modules-5.11.0-36-generic
  linux-modules-extra-5.11.0-36-generic
...
				
			

Once Tasksel is installed, open the Tasksel Utility.

				
					sudo tasksel
				
			

In the software selection interface, find and select the Ubuntu desktop using the Arrow and Space keys.

Click the Tab key to select OK and hit Enter. This will start the desktop package installation.

Next, set your system to boot into the graphical target using the following command.

				
					sudo systemctl set-default graphical.target
				
			

Output:

				
					Created symlink /etc/systemd/system/default.target → /lib/systemd/system/graphical.target.
				
			

Now restart your system for the changes to take effect.

Installing XRDP on Ubuntu

The Xrdp service launches immediately after the installation is complete. You can verify its proper installation by checking the status of its service.

				
					sudo systemctl status xrdp
				
			

Output:

				
					● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-06-07 03:01:29 PDT; 33s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
   Main PID: 2566 (xrdp)
      Tasks: 1 (limit: 5972)
     Memory: 788.0K
     …

				
			

Add the Xrdp User to the SSL-Cert Group

When you install Xrdp, it adds a user named “xrdp” to your system. The Xrdp session uses a certificate key file called /etc/ssl/private/ssl-cert-snakeoil.key, which is used for remote desktop connections.

To make sure that your remote desktop connections work properly, you need to add the “xrdp” user to the “ssl-cert” group with this command.

				
					sudo usermod -a -G ssl-cert xrdp
				
			

Edit the Xrdp File

Many users have reported issues with the black screen in the background. To resolve or avoid this issue, edit the /etc/xrdp/startwm.sh file.

				
					sudo nano /etc/xrdp/startwm.sh
				
			

And add the following code to the file.

				
					unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR

				
			

Press Ctrl+O and then Ctrl+X to save and exit from the editor.

Restart the Xrdp service to apply the changes.

Configure Firewall to Allow Remote Access

The Xrdp operates on port 3389 by default for the RDP protocol. Allow the UFW firewall to allow access to port 3389 for remote systems with the following command.

				
					sudo ufw allow from any to any port 3389
				
			

Output:

				
					WARN: Rule changed after normalization
Rules updated

				
			

Next, reload the UFW firewall to update the rules.

				
					sudo ufw reload
				
			

Your XRDP server is now installed and ready for the RDP client.

Connect to the remote desktop

On your Windows system, open the RDP client by typing “mstsc” in the command prompt. Next, enter the computer details and click on Connect.

You will get the warning message in the next window. To proceed, check the box next to “Don’t ask me for connection to this computer again” and click Yes.

Following a successful connection, enter the login credentials for the remote Ubuntu machine.

You will gain remote desktop access after successful authentication. And you will see your Ubuntu desktop screen.

How to Install XRDP Server (Remote Desktop) on Ubuntu 20.04 Conclusion

In this tutorial, we will show you how to install the XRDP server (remote desktop) on Ubuntu 20.04.

Xrdp Server is a free, open source, and highly configurable remote desktop server that allows users to remotely access the desktop of a computer running a UNIX, Linux, or Microsoft Windows operating system.

 The protocol is implemented in many open-source projects, such as FreeNX, Vinagre, and X2Go. If you are interested in other solutions like this, explore our content on RDP.

Avatar for Sobia Arshad
Sobia Arshad

Information Security professional with 4+ years of experience. I am interested in learning about new technologies and loves working with all kinds of infrastructures.

3 2 votes
Article Rating
Subscribe
Notify of
0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x