XRDP is an implementation of Microsoft's RDP protocol for Linux servers. Thanks to this adaptation, we can connect to Linux servers using a Windows Remote Desktop client. To use XRDP, we will need to install a graphical environment on our server. In this article, we will use the XFCE environment because it is much lighter in terms of resource consumption compared to KDE, GNOME, and Unity.
Installing the graphical environment and XRDP
The first thing you need to do is update the server:
# apt update && apt upgradeAfter updating the server, install the packages needed to use XFCE and XRDP:
# export DEBIAN_FRONTEND=noninteractive
# apt install -y ubuntu-desktop xfce4 xrdp xfce4-goodies
# echo xfce4-session > ~/.xsession
# systemctl restart xrdpInstallation may take a while, as there are many packages to install.
Creating a user (Optional)
For security, create an xrdpuser user to connect to the server. Using the root user is strongly discouraged:
# adduser xrdpuserAlso add the user to the sudo group:
# gpasswd -a xrdpuser sudoImproving XRDP performance (Optional)
XRDP's implementation of RDP is not as optimized as on Windows and only uses TCP packets. For this reason, you may sometimes notice latency when using it, but you can improve the experience by reducing the color quality and adjusting other options.
Copy the configuration file to create a backup:
cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bck Then edit the configuration file:
vi /etc/xrdp/xrdp.iniChange the "max_bpp", "xserverbpp", and "crypt_level" variables to the following values:
max_bpp=16
xserverbpp=16
crypt_level=lowIn the same configuration file, you can add the variable "use_compression" after "max_bpp" with the following value:
use_compression=yesThis way, the quality will be 16 bits per pixel even if 32-bit color has been specified in the RDP client. This will improve the smoothness of the connection, and the color change is not that significant. Low-level encryption and compression will also be used to optimize each packet.
Connecting via Remote Desktop
Now that you have XRDP installed, you can log in with the user you created from any remote desktop client:
Have you tried it? Leave us your comments! 🙂