Greenwebpage Community Blog Tutorials How to Install XRDP on Debian 12
Tutorials

How to Install XRDP on Debian 12

Being able to remotely connect to any of the machines and do what I need to on one of them is pretty helpful when it comes to monitoring or finding bugs in the system. Microsoft provides a remote desktop protocol that is part of the native Windows operating system. But currently, it is also possible to use XRDP to access different operating systems other than Windows (such as Debian) remotely. XRDP is a free and open-source remote desktop protocol software that allows connection to a remote computer.

Table of Contents

How to Install XRDP On Debian 12

There are some steps to see that XRDP is installed on Debian with some additional installation and configuration steps:

Step 1: Install XFCE Desktop Environment on Debian 12

In order to work nicely when accessed through a remote/network location, you should install a relatively minimal and configurable desktop environment on your Debian system. Thus, to install XRDP on Debian 12, you need to install XFCE desktop and some other tools:

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

In the command above,

  • xfce4 is the package for the XFCE desktop environment.
  • xfce4-goodies are additional plugins and themes for the XFCE desktop environment.
  • xorg is a package that offers the X Window System (the GUI for Linux).
  • dbus-x11 is another package that serves the purposes of the D-Bus message bus system.
  • x11-xserver-utils is a package with some utilities for the X server, including xrandr, xset, and xprop.
sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils

Step 2: Install XDRP

Once the XFCE environment is installed, reboot your system, then install XRDP using the default package manager as shown below.

sudo apt install xrdp

After installing the Remote Desktop Protocol, check its service status to ensure that it is running. For that run:

sudo systemctl status xrdp

If by any chance it is not the ‘running’, then to first ‘enable’ it and ‘start’ it, just run the commands:

systemctl enable xrdp
systemctl start xrdp

Step 3: Create an XRDP User

The group SSL-Cert keeps track of certificates used to protect SSL connections between the client and server. So we need to include XRDP in this SSL cert group too. To do this, just run:

sudo adduser xrdp ssl-cert

Step 4: Restart XRDP Services

After the user is added successfully, let’s restart the Remote Desktop protocol to take effect and for the system to restart the command.

sudo systemctl restart xrdp

How to Configure XRDP on Debian 12

Now we need to disable the default X session to start up XFCE when someone is connecting to a remote desktop. So, for that, let’s open up the starttwm. sh file by commenting these two lines of code below:

sudo nano /etc/xrdp/startwm.sh

After you have commented the intended line of code, enter the command that will start the XFCE environment:

startxfce4

Save and close the file, and restart the xrdp:

sudo systemctl restart xrdp

The Remote Desktop Protocol communicates between the client and other devices through the default port 3389. Opening that port via the firewall means the client can reach any remote server, etc. So.. to let it through the firewall, you need to install it first:

sudo ufw allow 3389/tcp

After you added the port in the firewall, check the firewall status, and if the rule is not there, just reload the firewall to take effect the changes:

sudo ufw reload

How to Connect Debian 12 Remotely

After you have successfully installed and configured the XRDP server, it is time to access the Debian system from the Windows operating system. There are 2 ways to remotely access a Debian server.

Connect to Debian 12 from Windows With XRDP

On your Windows system, open up the RDP and enter the IP or computer name and log in with your username, and click on Connect:

Now you do a click to CONNECT and this will open you an XRDP window, now simply input the password of the account you are logging in using, then click on connect:

Once the credentials have been verified and the communication between the host and the target system has been made, a window pops up that presents you with the desktop of Debian 12:

Alternative Method

Another way you can connect to Debian 12 is to enable Remote Desktop in Debian 12. If you are unable to log in remotely using XRDP in Debian 12, you can apply the following solution. If, typically, the remote desktop access is not enabled by default, and when you try to connect, we may get the above error:

As in the above screenshot, the first reason says that the remote access is not enabled on the accessing computer, which means, in this case, the remote access is not enabled. For that, open the settings of Debian 12, then open the sharing settings, and from there open Remote Desktop as:

Once you are in the options for remote desktop, turn it on, and then we need to make a note of the name of the user and their password that can access the system remotely:

Now, after you have entered the computer name and the username, you will get this pop-up once you click on the connect option in the Windows Remote Desktop application. Here, just enter the same password that was given in Debian sharing settings and click ok:

Once the connection is successful, you will have remote access to Debian 12:

Accessing Debian 12 on Windows can make your system a little bit laggy, so in that case, you can make some tweaks by clicking on the Display tab on the Remote Desktop Connection application. From here, you can choose the size of the display along with the color quality.

Connecting Any System Remotely Using XRDP on Debian 12

Using the XRDP cannot only be used to access the Linux system, but it can also be used to access any other system from Debian. So, in that case, you will need a remote desktop viewer along with XRDP. The remote desktop viewer is not installed by default, but you can install it from a software application in Debian 12.

To remotely connect to another computer, you first need to know about the host’s Internet Protocol address, so to execute:

ip a

Once you have got the Debian IP address, launch the Remote Desktop Viewer from the applications menu:

Now just click on connect, and then first select the protocol that will be RDP, and then enter the IP address of the host. Afterward, enter the username of the system that you want to access, adjust the dimensions of the screen, and click on Connect:

Now, just click on Connect on the prompt about the certificate verification to continue the process of accessing the computer remotely:

Now the XRDP window will open, just enter the username and password of the computer you want to access remotely, and then click on connect:

How to Remove XRDP from Debian 12

To remove XRDP completely from Debian 12, execute:

sudo apt autoremove xrdp

Conclusion

To install XRDP on Debian 12, first install a lightweight and efficient desktop environment and then use the advanced packaging tool to install XRDP. Afterward, configure XRDP in Debian by allowing access to the 3389 port from the firewall, and then use the remote desktop viewer to access any other system remotely. To access your system remotely from Windows, open up the Remote Desktop Connection application installed on it, and from there, enter the login details of your Debian system in the XRDP window after entering your IP address.

Exit mobile version