Xrdp is an open source implementation of the Microsoft Remote Desktop Protocol (RDP) that you can use to graphically control a remote system. With RDP, you can log into the remote machine and create a real desktop session as if you were logged into a local machine.
In this tutorial you will learn how to install and configure the Xrdp server on Ubuntu 20.04.
Install desktop environment
Ubuntu servers are managed from the command line and do not have a desktop environment installed by default. If you’re running the desktop version of Ubuntu, skip this step.
Various desktop environments are available in Ubuntu repositories. One way is to install Gnome, the standard desktop environment in Ubuntu 20.04. Another option is installation Xfce
. It’s a fast, stable, and lightweight desktop environment that makes it ideal for use on a remote server.
Run one of the following commands to install the desktop environment of your choice.
sudo apt update
sudo apt install ubuntu-desktop
sudo apt update
sudo apt install xubuntu-desktop
Depending on your system, GUI packages may take some time to download and install.
Installation of Xrdp
Xrdp is included in the standard Ubuntu repositories. To install it, do the following:
sudo apt install xrdp
Once the installation is complete, the Xrdp service will start automatically. You can check it out by typing:
sudo systemctl status xrdp
The output looks something like this:
● xrdp.service - xrdp daemon Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-05-22 17:36:16 UTC; 4min 41s ago ...
By default, Xrdp uses the
/etc/ssl/private/ssl-cert-snakeoil.key File that can only be read by members of the “ssl-cert” group. Run the following command to add the
xrdp User to group:
sudo adduser xrdp ssl-cert
Restart the Xrdp service for the changes to take effect:
sudo systemctl restart xrdp
That’s it. Xrdp has been installed on your Ubuntu server and you are ready to use it.
The Xrdp configuration files are located in the
/etc/xrdp Directory. You do not need to make any changes to the configuration files for simple Xrdp connections.
Xrdp uses the standard X Window desktop environment (Gnome or XFCE).
The main configuration file is called
. This file is divided into sections and allows you to set global configuration settings such as security and listening addresses and to create various xrdp login sessions.
Whenever you make changes to the configuration file, you must restart the Xrdp service.
startwm.sh File to start the X session. If you want to use a different X Window desktop, edit this file.
Configure the firewall
The Xrdp daemon listens on port
3389 on all interfaces. If you are running a firewall on your Ubuntu server, you will need to open the Xrdp port.
For example, to enable access to the Xrdp server from a specific IP address or an IP range,
192.168.33.0/24, you would run the following command:
sudo ufw allow from 192.168.33.0/24 to any port 3389
If you want to allow access from anywhere (which is strongly discouraged for security reasons), do the following:
sudo ufw allow 3389
For added security, you can set up Xrdp to only listen on localhost and create an SSH tunnel that securely forwards traffic from your local computer to port
3389 to the server on the same port.
Connect to the xrdp server
Now that you’ve set up your Xrdp server, it’s time to open your Xrdp client and connect to the server.
If you have a Windows PC, you can use the standard RDP client. Type “Remote” in the Windows search bar and click “Remote Desktop Connection”. This will open the RDP client. Enter the IP address of the remote server in the “Computer” field and click “Connect”.
Enter your username and password on the login screen and click OK.
Once you’re signed in, you should see the default Gnome or Xfce desktop. It should look something like this:
You can now interact with the remote desktop from your local computer using your keyboard and mouse.
If you’re using macOS, you can install the Microsoft Remote Desktop application from the Mac App Store. Linux users can use an RDP client such as Remmina or Vinagre.
When you configure a remote desktop, you can manage your Ubuntu 20.04 server from your local computer through an easy-to-use graphical interface.
If you have any questions, feel free to leave a comment below.