OS: Debian 11 (Bullseye)
Xrdp is the open-source implementation of the Microsoft Remote Desktop Protocol (RDP that allows you to control a remote linux server graphically. For any technical folks especially pentester that are doing web penetration testing using kali or any variants of Linux for that, will find Xrdp useful.
There are alot of other remote GUI tools out there for Linux, but I find Xrdp one of the simplest to start as you can use the same RDP client for Windows RDP session.
Before installing the Xrdp server. You want to make sure that you have a lightweight Desktop environment install in your Debian Server. In this tutorial we will be installing Xfce, there are other lightweight desktop available that you can use for Debian. In this tutorial we will be using Xfce.
The following command install Xfce.
sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils
Once you have install the lightweight desktop environment you can install Xrdp.
sudo apt install xrdp
Once you complete the installation check the status. You should see Xrdp is active and running.
sudo systemctl status xrdp
To create persistency you can issue the command to start xrdp automatically everytime you reboot the machine.
sudo systemctl enable xrdp
Additional Steps that you can do to prepare for the Xrdp session.
By Default the SSL certificate that for Debian Server is stored in the following folder. /etc/ssl/private/ssl-cert-snakeoil.key
You can add the the rdp user to the following group.
sudo adduser xrdp ssl-cert
To edit any additional xrdp setting you can go to /etc/xrdp/xrdp.ini
If you are not using SSH Tunnel to connect the xrdp service, you will need to allow access through the firewall. Here is the command to allow access through ufw.
sudo ufw allow 3389