Install XFCE on Debian with XRDP

I will use Debian 12 (Bookworm) as today sample.

Install tasksel

apt install tasksel -y 

Run tasksel to install tasksel

If you run tasksel --list-tasks it will show current installed Desktop environment

Install XFCE

apt install xfce4 xfce4-goodies -y

Configure Display Manager

By default, Debian might not have a graphical login manager installed. If you prefer a graphical login screen instead of logging in directly through the console, you can install a display manager like LightDM:

apt install lightdm
service lightdm restart

dpkg-reconfigure lightdm

If you installed other Display Manager such as slim before, please do dpkg-reconfigure lightdm to set lightdm as default X Window system.

Install dbus-x11

If you have this error: Failed to execute child process “dbus-launch” on ‘Open in Terminal’ then you should install dbus-x11

apt install dbus-x11

Finally we came to last step which is by using XRDP to remote control our Debian VPS.

Install XRDP

apt install xrdp -y

Do service restart for xrdp make sure everything is install and configure properly.

service xrdp restart

Add user for XRDP

adduser xrdp ssl-cert

Configure xrdp to use XFCE

Allow initiate XFCE for incoming RDP connection.

nano /etc/xrdp/startwm.sh

Modify /etc/xrdp/startwm.sh and comment out below and add startxfce4 at the end of line.

#test -x /etc/X11/Xsession && exec /etc/X11/Xsession
#exec /bin/sh /etc/X11/Xsession

startxfce4

Restart the XRDP service again

systemctl restart xrdp

Configure xrdp Port (Optional)

The xrdp server monitors incoming RDP connections on port number 3389. Using a different port for RDP connections is a form of protection through obscurity. It is not a foolproof security measure, but it can protect a system from brute-force attacks.

To instruct xrdp to listen on a non-standard port:

1. Use nano to edit the xrdp configuration file, xrdp.ini:

sudo nano /etc/xrdp/xrdp.ini

2. Locate the port parameter in the [Globals] section and set the desired value. In this example, the RDP port is 49974:

port=49974

References

  1. https://phoenixnap.com/kb/debian-remote-desktop
  2. https://askubuntu.com/questions/1407041/failed-to-execute-child-process-dbus-launch-on-open-in-terminal-ubuntu-22-0
  3. https://github.com/tarqmamdouh/tigervnc-gnome
  4. https://shape.host/resources/how-to-set-up-and-install-vnc-server-on-debian-12
  5. https://blog.mowd.tw/p/6691