Setting up a remote desktop on Debian 12 lets you connect to and control the machine from anywhere — using the standard Windows Remote Desktop Connection client over the network.
The process involves installing the xfce4 desktop environment, the xrdp server, and configuring the firewall to allow incoming RDP connections on port 3389.
Quick Answer
Install xfce4 and xrdp, add startxfce4 to /etc/xrdp/startwm.sh, allow port 3389 in UFW, then connect from Windows using Remote Desktop Connection with the Debian machine’s IP.
How to Connect Debian 12 to Remote Desktop
Step 1: Update apt packages
Start by updating your system packages on the Debian machine to ensure you install the latest versions of xfce4 and xrdp from the repositories.
sudo apt update && sudo apt upgrade

Step 2: Install the xfce4 desktop environment
xrdp requires a desktop environment to serve to remote clients. Install xfce4 — it’s lightweight and has excellent compatibility with xrdp’s remote rendering pipeline.
sudo apt install xfce4 xfce4-goodies -y

Reboot the system after xfce4 installs so the desktop environment initializes correctly before you proceed to install xrdp on top of it.
sudo reboot

Step 3: Install xrdp
Open the xfce terminal after rebooting, then install xrdp — the X Remote Desktop Protocol server that listens for incoming RDP connections from Windows clients.

sudo apt install xrdp -y

Verify xrdp is active after installation. The output should show Active (running) — confirming the service started successfully and is ready to accept connections.
sudo systemctl status xrdp

Step 4: Configure xrdp to launch xfce4
Edit the xrdp startup script to tell it to launch xfce4 when a remote session connects — without this, xrdp starts but delivers a blank or broken desktop to the client.
sudo nano /etc/xrdp/startwm.sh

Comment out the two default Xsession lines by adding a # before each, then add startxfce4 as a new line at the bottom of the file before saving.
#test -x /etc/X11/Xsession && exec /etc/X11/Xsession
#exec /bin/sh /etc/X11/Xsession
startxfce4

Save the file with Ctrl+S and exit nano with Ctrl+X, then restart xrdp to apply the configuration change to all new incoming connections.
sudo systemctl restart xrdp

Step 5: Check the RDP port and enable xrdp
xrdp uses port 3389 by default. Verify this in /etc/xrdp/xrdp.ini and enable the service so it starts automatically on every system reboot.
sudo nano /etc/xrdp/xrdp.ini

systemctl enable xrdp

Step 6: Configure the UFW firewall
Add the xrdp user to the ssl-cert group and open port 3389 in UFW — both steps are required for xrdp to negotiate a secure connection from the Windows RDP client.
sudo adduser xrdp ssl-cert
sudo ufw allow 3389
sudo ufw enable


Step 7: Get the Debian machine’s IP address
Run ip a on the Debian machine to find its local IP address — you will need this to connect from the Windows Remote Desktop Connection app on the client machine.
ip a

Step 8: Connect from Windows
On the Windows machine, open Remote Desktop Connection from the Start menu, click Show Options, enter the Debian machine’s IP address and your Debian username, then click Connect.


Accept the certificate warning, enter your Debian user credentials in the xrdp login screen, and click OK — the xfce4 desktop loads in the Remote Desktop window on Windows.


Bonus: Uninstall xrdp From Debian
To remove xrdp and all its configuration files from Debian 12, use apt purge — this removes the package and its associated config, unlike apt remove which leaves configs behind.
sudo apt purge xrdp -y

When to Use Remote Desktop on Debian
Use xrdp when you need a full GUI environment on a headless Debian server — it’s faster than VNC over LAN and works natively with the Windows Remote Desktop Connection client.
It’s ideal for managing a home server, NAS, or development machine from another room or another computer — without needing a physical monitor connected to the Debian machine.
For command-line-only remote access, SSH is lighter and requires no desktop environment — use xrdp only when you specifically need graphical application access on the remote machine.
Related Guides
These guides cover related Linux system administration and cross-platform tools for managing and connecting to remote machines from Windows.