This tutorial describes how to set up an xRDP server to connect to Ubuntu 18.04 with the lightweight graphical Xforce UI using the RDP protocol. This can be very handy when you need to connect to Linux operating systems with graphical interface from Windows using Remote Desktop.
What is xRDP?
xRDP is Microsoft's free and open-source implementation of RDP (Remote Desktop Protocol) which allows non-Microsoft Windows operating systems (such as Linux and BSD) to provide a fully functional RDP-compatible remote desktop.
Installation and Setup
Connect to your ubuntu server via SSH and perform a system update:
sudo apt-get upgrade -y
Install and enable the xRDP utility:
sudo systemctl enable xrdp
sudo systemctl restart xrdp
Install the xfce environment:
Open RDP port to be able to connect remotely:
Reboot the xRDP server for the changes to take effect:
Connecting to an Ubuntu Server via RDP
If you don't know the IP address of the Ubuntu server, you can check it by entering the command:
In our test case it is 10.0.0.2. To connect open the Windows Remote Desktop Connection (mstsc.exe). Enter the IP address of the server and click Connect:
A security warning will appear. Click Yes:
In the opened window, select Xorg as the session, enter the username and password for the user and click OK:
This will connect to the xforce desktop.
If it shows a black screen when connecting to xrdp you need to go into the /etc/xrdp folder, and make changes to the startwm.sh file.
We need to add:
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
Before the line:
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
After making the changes you have to restart the XRDP service:
Now you can run mstsc.exe again and connect to our ubuntu server.