How to Install Xrdp Server on Debian 11

Xrdp is an open-source implementation of Microsoft’s Remote Desktop Protocol (RDP), allowing you to access a remote computer graphically. It performs the remote access functionality by bridging graphics from the X Windows system to an RDP client and relaying controls from the RDP client back to the X Windows.

Using RDP, you can log in to a system remotely and establish a desktop session the same way you logged into your local machine. Linux, Windows, macOS, Android, all of these operating support RDP.

This write-up will demonstrate to you how you can install Xrdp Server on your Debian 11 system. Moreover, we will also show you how to establish a remote connection between Windows and Debian 11 system, which is installed on VirtualBox. Let’s start!

How to install Xrdp Server on Debian 11

Open up your Debian 11 terminal by pressing “CTRL+ALT+T” and update its repositories:

$ sudo apt update

If you do not have a Desktop Environment for your Debian system, you have to install one. We recommend installing “Xface” for this purpose, as it is a lightweight and fast desktop environment and considered “ideal” for using the remote server.

To install the Xfce Desktop Environment on your system, execute this command:

$ sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils

After updating the system repositories and installing Xfce packages, execute the below-given command:

$ sudo apt install xrdp 

This command will let you install Xrdp Server on your system:

In the next step, we will check out the status of Xrdp on our Debian 11 system:

$ sudo systemctl status xrdp

From the output, you can see that the “xrdp” service is running:

The “/etc/ssl/private/ssl-cert-snakeoil.key” certificate key file, utilized by the xrdp sessions plays its part in establishing remote connection. By default, “root” is the owner of “/etc/ssl/private/ssl-cert-snakeoil.key” file and “ssl-cert” is the group owner.

When you install xrdp on Debian 11, it automatically creates a user named “xrdp”. To permits the xrdp user to access the certificate key file, execute this given command in your terminal:

$ sudo adduser xrdp ssl-cert

This command will add the “xrdp” user to the “ssl-cert”:

After that, restart the xrdp service on your Debian 11 system:

$ sudo systemctl restart xrdp

How to configure Firewall for xrdp Server on Debian 11

On Debian 11 system, Xrdp listens on port 3389 by default. If firewall is enabled on your system, you have to add a rule for permitting the traffic on the Xrdp port.

Utilize the following command for allowing access to the Xrdp server from a certain IP address. For instance, we will add the “192.168.43.1/24” IP address in the below-given command:

$ sudo ufw allow from 192.168.43.1/24 to any port 3389

For security reasons, we do not recommend you to allow traffic from anywhere. However, if you want to do so, then execute this command:

$ sudo ufw allow 3389

Now, we will reload the Firewall of our Debian 11 system so that it can take effect from the added new rules:

$ sudo ufw reload 

That was all about the installation and configuration of Xrdp.

How to configure VirtualBox for xrdp Server on Debian 11

If you want to establish a connection between your host machine and the machine installed on your VirtualBox, then follow the provided procedure:

First of all, open up the “Settings” of your installed machine:

Now, from the left-side menu, click on the “Display”, and check the “Enable Server” option:

In the Network category, change the “Attached option” to “Bridged Adapter” and press “OK”:

How to set up a Remote Connection from Windows to Debian 11

The Windows operating system provides a “Remote Desktop Connection” application to establish a connection to any device present on the same network. This section will demonstrate how you can set up a remote connection between your Windows system and Debian 11 installed on the VirtualBox.

First of all, search for the “Remote Desktop Connection” and open it on your Windows system:

Now, add your Computer name or its IP address and click on the “Connect” button:

Remote Desktop connection application will take few seconds for configuring the remote session:

In the next step, we will add the “username” and “password” of our Debian 11 system:

And here you go with the remote access of your Debian system!

Conclusion

Linux-based systems such as Debian 11 allow you to manage your system from any local machine using the Xrdp server. Xrdp Server is based on RDP protocol through which you can remotely access another machine present in the same network. In this write-up, we have covered how to install Xrdp on Debian 11 system. The configuration of Firewall on Debian system and the required settings of the VirtualBox is also demonstrated in the article. In the last section, you have seen a practical example of establishing a remote connection between Windows and Debian 11.