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
sudo apt update and upgrade running on Debian 12 terminal

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
Installing xfce4 and xfce4-goodies on Debian 12

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

sudo reboot
sudo reboot command to apply xfce4 installation on Debian 12

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.

Opening xfce terminal on Debian 12 after installation
sudo apt install xrdp -y
sudo apt install xrdp running on Debian 12

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
systemctl status xrdp showing Active running on Debian 12

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
Opening /etc/xrdp/startwm.sh with nano editor on Debian 12

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
startwm.sh file with Xsession lines commented out and startxfce4 added

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
systemctl status xrdp showing Active after restart with xfce4 config

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
xrdp.ini file showing port 3389 configuration on Debian 12
systemctl enable xrdp
systemctl enable xrdp output on Debian 12

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
UFW status showing port 3389 allowed for xrdp on Debian 12
sudo ufw enable confirming firewall is active on Debian 12

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
ip a output showing Debian 12 IP address for remote desktop connection

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.

Remote Desktop Connection app in Windows Start menu search results
Remote Desktop Connection — General tab with Debian IP address and username entered

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.

xrdp login screen prompting for Debian username and password credentials
Debian 12 xfce4 desktop loaded inside Windows Remote Desktop Connection window

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
sudo apt purge xrdp removing xrdp from Debian 12

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.