How To Install XRDP (Remote Desktop) on Debian 10

Linux & SBC 6 Th12 2021

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.

The XRDP allows two-way clipboard transfer, audio and microphone voice redirection and allows us to mount local drives on the remote machines.

This tutorial helps you to Install XRDP Server (Remote Desktop) on the Debian 10 Linux system.

How To Install XRDP (Remote Desktop) on Debian 10
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. The XRDP allows two-way cli…

Prerequisities

You must have shell access with a sudo privilege user to the Debian 10 system

Step 1 – Installing Desktop Environment

By default, Debian Servers doesn’t have an installed Desktop Environment. XRDP server is designed to controls only desktop systems. So you will need to add a desktop environment to your system.

Open a terminal and upgrade all installed packages with the following command:

sudo apt update && apt install tasksel -y 

After installing Tasksel, launch the Tasksel utility with the following command:

sudo tasksel 

You should see the following interface:

Installing Desktop on Debian 10 with Tasksel

Use the arrow key to scroll down the list and find Debian Desktop Environment. Next, press the Space key to select it, also choose the Dekstop type, then press the Tab key to select OK then hit Enter to install the desktop environment.

Once all the packages are installed, you will need to set your system boots into the graphical target. You can set it with the following command:

sudo systemctl set-default graphical.target 

Next, restart your system to apply the changes.

Step 2 – Installing XRDP on Debian 10

The Xrdp Debian packages are available under the default system repositories. You can install a remote desktop on your Debian system by executing the following command.

sudo apt install xrdp -y 

Once the xrdp installation finished successfully, its service will be started automatically. To verify the service status run the command:

sudo systemctl status xrdp 
Running XRDP Server on Debian 10

The above output shows the Xrdp service is up and listening on port 3389.

Step 3 – Configuring Xrdp Service

The installation process creates a user named xrdp in your system. The XRDP sessions uses a certificate key file “/etc/ssl/private/ssl-cert-snakeoil.key”, which plays an important role with remote desktop. This key file is owned by root and the group owner is “ssl-cert”

So we need to allow xrdp user to access this key file. To do this, add the xrdp user to the “ssl-cert” group with the following command.

sudo usermod -a -G ssl-cert xrdp 

Sometimes user faces issue with black screen appears in background. So, that I ahave included steps to resolve black screen issue in background. Edit the xrdp file /etc/xrdp/startwm.sh in a text editor:

sudo nano /etc/xrdp/startwm.sh 

Add these commands before the commands that test & execute Xsession as shown below:

Unset DBUS_SESSION_ADDRESS Unset XDG_RUNTIME_DIR

XRDP Fix Black Screen Issue

Press CTRL+O to write out and then CTRL+X to exit from the editor.

Restart the Xrdp service by running the command given below:

sudo systemctl restart xrdp 

Step 4 – Adjust Firewall

The Xrdp listens on port 3389, which is the default port for the RDP protocol. You need to adjust the firewall to allow access to port 3389 for remote systems.

Systems running with UFW firewall, 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 

You can change 192.168.1.0/24 with 0.0.0.0/0 to open for all.

Reload the UFW to apply the new rules.

sudo ufw reload 

All right, Your system is ready to access over RDP protocol.

Step 5 – Connect to Remote Desktop

The Xrdp service is successfully installed and ready to connect. 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 "mstsc" in the run window or command line.

Connect to Remote Desktop (RDP)

The first time, it will prompt a warning message due to the remote system is unknown for your system. Check the box in front of “Don’t ask me again for connection to this computer” and click Yes to continue.

Once connected successfully, the remote system prompt for authentication. Enter the login credentials of the remote Debian system to get remote desktop access.

On successful authentication, you’ll get remote desktop access.

Connected XRDP Session on Debian 10

That’s it. Now, you can manage your remote Debian system with a graphical interface.

Conclusion

This tutorial helped you to set up XRDP Server (Remote Desktop) service on Debian 10 Linux system. Additionally provides you the steps to install Desktop Environment on a Debian Linux system.

Tags

Tony Phạm

Là một người thích vọc vạch và tò mò với tất cả các lĩnh vực từ khoa học tự nhiên, lập trình, thiết kế đến ... triết học. Luôn mong muốn chia sẻ những điều thú vị mà bản thân khám phá được.