Jump toUpdate content
Configure a remote desktop with xRDP on Ubuntu Bionic Beaver
xRDP is an open-source alternative to Microsoft RDP (Microsoft Remote Desktop Protocol).
The tool provides a graphical login to remote machines and accepts connections from variety of RDP clients: FreeRDP, rdesktop, NeutrinoRDP and Microsoft Remote Desktop Client (for Windows, macOS, iOS and Android).
RDP connections are encrypted by default using TLS for increased security.
In this tutorial you will learn how to install the xrdp server together with xfce, a lightweight and stable desktop environment ideally suited for the use as a remote desktop.
Connect to your instance using
aptsources list and upgrade the software already installed on the instance:
apt update && apt upgrade -y
Install the required packages for the desktop environment using the
apt install xorg xfce4 xfce4-goodies dbus-x11 x11-xserver-utils
The xRDP server is available in the default Ubuntu repositories and it can be installed easily using
apt. The following command installs the packages
ufwa firewall to protect your instance from unauthorized access:
apt install xrdp ufw
The packet manager configures the service to be automatically started upon system reboot. Run the following command to check that the service has been started during the installation:
systemctl status xrdp
You will see a message like the following, confirming the status
● xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2019-12-02 16:06:15 UTC; 9s ago
In case the service has not been started automatically, start it with
systemctl start xrdp
Open the xrdp configuration file in a text editor of your choice, for example
Scroll to the bottom of the file and add the following line, then save the file and exit the text editor:
Restart the xrdp service using
systemctlto activate the new configuration:
systemctl restart xrdp
Restrict the access to port
3389to an IP address or a range of IPs. To allow access from the block
192.168.1.0/24launch the following command:
ufw allow from 192.168.1.0/24 to any port 3389
To allow connections from any host (which may cause a huge security risk) run the following command:
ufw allow 3389Tip:
For more information how to configure the firewall of your instance, you may read our tutorial about the configuration of ufw on Ubuntu.
For security reasons, it is recommended to create a regular user to connect to the remote desktop.
Add the user with the
(Optionally) If you want to give superuser rights to the user, install sudo using the
apt install sudo
(Optionally) Add the user to the sudoers file:
adduser <myuser> sudo
Download and install a RDP client of your choice. We will use the Microsoft Remote Desktop Client in this tutorial.
Start the RDP client and click Add Desktop to add a new connection :
Enter the connection details. You need to enter at least your instances IP in the PC name. Optionally you can add a Friendly Name to facilitate the identification of your instance in case you configure several RDP connections.
Double click the connection icon. During the first connection, you may be asked to validate the fingerprint of the instance. Click OK to confirm the connection.
Enter the identifier and password of your regular user when prompted.
You are now connected and the remote desktop displays. You can launch applications on the remote machine, as you would do locally.