In this article, we want to teach you how to Install and Configure XRDP on Debian 11.
XRDP is an open-source implementation of the Microsoft RDP (Remote Desktop Protocol) server. It provides bridging between the RDP client and the X windows system. The XRDP server allows remote users to graphical login to the remote machines using the Microsoft RDP client.
How To Install and Configure XRDP on Debian 11
Before you start to install XRDP on Debian 11, you need to log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do these, you can check our article about the Initial Server Setup with Debian 11.
Now you can start to install the Desktop environment on Debian 11.
Install the Desktop Environment on Debian 11
There are several desktop environments (DE) available in Debian repositories. We’ll be installing Xfce.
First, update the local package index with the following command:
sudo apt update
Then, install the Xfce packages with the following command:
sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils
This may take some time to install.
Now you can install XRDP on your server.
Install XRDP on Debian 11
The XRDP packages are available on the default Debian repository. You can install it with the following command:
sudo apt install xrdp -y
Verify that the XRDP is active and running on Debian 11 with the following command:
sudo systemctl status xrdp
Output xrdp.service - xrdp daemon Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: > Active: active (running) since Tue 2021-11-09 08:10:53 EST; 46s ago Docs: man:xrdp(8) man:xrdp.ini(5) Process: 1363 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, > Process: 1371 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0> Main PID: 1372 (xrdp) Tasks: 1 (limit: 2325) Memory: 760.0K CPU: 59ms CGroup: /system.slice/xrdp.service └─1372 /usr/sbin/xrdp
The installation process creates a user named xrdp in your system. The XRDP sessions use a certificate key file “/etc/ssl/private/ssl-cert-snakeoil.key”. This key file is owned by root and the group owner is “ssl-cert”
So you need to allow xrdp users to access this key file. To do this, add the xrdp user to the “ssl-cert” group with the following command:
sudo adduser xrdp ssl-cert
Output Adding user `xrdp' to group `ssl-cert' ... Adding user xrdp to group ssl-cert Done.
When you have XRDP active and running on Debian 11, let’s start to configure it.
Configure XRDP service
For basic Xrdp connections, you do not need to make any changes to the configuration files. Xrdp will use the default X Window desktop, which in this case, is XFCE.
The main configuration file is named
xrdp.ini . This file allows you to set global configuration settings such as security and listening addresses and create different xrdp login sessions.
Whenever you make any changes to the configuration file you need to restart the Xrdp service on Debian 11:
sudo systemctl restart xrdp
startwm.sh file to launch the X session. To use another X Window desktop, edit this file.
Now you need to adjust the firewall to access the XRDP on Debian 11.
The Xrdp listens on port 3389.
You can use the following command to open port 3389 for the LAN network:
sudo ufw allow from 192.168.1.0/24 to any port 3389
Note: If you want to allow access from anywhere you can use the following command:
sudo ufw allow 3389
To apply the new rules reload the firewall with the following command:
sudo ufw reload
Now you can access the xrdp on Debian 11.
How To Access the Remote Desktop
On your Windows client, open the RDP client and enter the IP address of the Debian system.
You can launch the RDP client by typing the “mstsc” in the Run window or command line.
It will ask for a warning message that the remote system is unknown to your system.
Click the “Don’t ask me again for connection to this computer” and click Yes to continue.
Now enter the login credentials of the remote Debian system to get remote desktop access:
When you have logged in you will see:
You can now start interacting with the remote XFCE desktop from your local machine using your keyboard and mouse.
If you are 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.
At this point, you learn to set up a desktop environment and install XRDP on Debian 11. Now you can manage your server from the local desktop machine in a graphical interface.