Xrdp is an open source implementation of Microsoft Remote Desktop Protocol (RDP) that allows you to graphically control remote systems. With RDP, you can log in to a remote computer and create a real desktop session, just as you log in to your local computer.
This tutorial shows how to install and configure Xrdp server on Ubuntu 18.04.
If you want an open source remote desktop access solution, use VNC.
Install the desktop environment
Usually, the Linux server does not have a desktop environment installed. Our first step is to install X11 and a lightweight desktop environment that will act as the backend for Xrdp.
There are several desktop environments (DE) available in the Ubuntu repository. We will install Xfce. This is a fast, stable, and lightweight desktop environment that is ideal for use on remote servers.
Type the following command as a user with sudo privileges to install Xfce on your server:
sudo apt update sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils
Depending on your system, downloading and installing the Xfce package will take some time.
Install Xrdp
Xrdp packages are available in the default Ubuntu repository. To install it, run:
sudo apt install xrdp
After the installation process is complete, the Xrdp service will start automatically. You can verify that Xrdp is running by typing:
The output will look like this:
xrdp.service - xrdp daemon Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2019-07-28 22:40:53 UTC; 4min 21s ago Docs: man:xrdp(8) man:xrdp.ini(5) ...
Configure Xrdp
The Xrdp configuration file is located in the / etc / xrdp directory. For basic Xrdp connection, we only need to configure Xrdp to use Xfce. To do this, open the following file in a text editor:
/etc/xrdp/xrdp.ini
sudo nano /etc/xrdp/xrdp.ini
Add the following line at the end of the file:
exec startxfce4
Save the file and restart the Xrdp service:
sudo systemctl restart xrdp
Configure firewall
By default, Xrdp listens on port 3389 on all interfaces. If you are running a firewall on an Ubuntu server (which should always be done), you need to add a rule to enable traffic on the Xrdp port.
To allow access to the Xrdp server from a specific IP address or IP range, in this example 192.168.1.0/24, run the following command:
If you want to allow access from anywhere (highly recommended for security reasons), run:
For added security, you can consider setting Xrdp to listen on only the local host and create an SSH tunnel that will securely forward traffic from the local computer on port 3389 to a server on the same port. Another security option is to install OpenVPN and connect to the Xrdp server over a private network.
Connect to Xrdp server
Now that you have set up the Xrdp server, it's time to open the Xrdp client and connect to the server.
If you are a Windows user, you can use the default RDP client. Type "remote" in the Windows search bar and click "Remote Desktop Connection". This will open the RDP client. Enter the remote server IP address in the computer field and click Connect.
On the login screen, enter your username and password, and click OK.
After logging in, you should see the default Xfce desktop. It should look like this:
You can now start interacting with the remote XFCE desktop from your local computer using your keyboard and mouse.
in conclusion
After installing the Xrdp server, you can manage the Ubuntu 18.04 server from your local desktop using an easy-to-use graphical interface.