This is an old revision of the document!


XRDP

  • Step 1: Install Xfce4 and xRDPFirst, open your terminal and install the desktop environment and xRDP packages (these examples use Debian/Ubuntu-based distributions):
    sudo apt update
    sudo apt install xfce4 xfce4-goodies xrdp -y
  • Step 2: Configure the Desktop Session. You need to tell the xRDP server to load the Xfce desktop environment instead of the default Linux desktop. Set Xfce4 as the default for your active user by running:
    echo "xfce4-session" > ~/.xsession
  • Make the file executable:
    chmod +x ~/.xsession
  • Step 3: Edit the xRDP Startup ScriptTo prevent session dropouts, update the global xRDP configuration file:Open the file with your preferred text editor (e.g., nano):
    sudo nano /etc/xrdp/startwm.sh
  • Comment out the last two lines by adding a # at the beginning, so they look like this:
    # test -x /etc/X11/Xsession && exec /etc/X11/Xsession
    # exec /bin/sh /etc/X11/Xsession
  • Add startxfce4 right before the last line of the file (usually exit 0), ensuring your file ends similarly to this:
    startxfce4
    exit 0
  • Save and close the file.
  • Step 4: Add the xRDP User to the SSL Cert Group
    On some systems (like newer Ubuntu versions), the xrdp user needs permission to read the SSL certificates, otherwise, you might experience black screen issues:
    sudo adduser xrdp ssl-cert
  • Step 5: Restart the Service and Open the Firewall. Restart the xRDP service to apply all configuration changes:
    sudo systemctl restart xrdp
  • If you are using a firewall (such as ufw), make sure to open the RDP port so your remote device can connect:
    sudo ufw allow 3389
  • Step 6: You can now open the Remote Desktop Connection app on Windows or the Microsoft Remote Desktop app on Linux. Enter your Linux computer's IP address and log in using your standard Linux username and password.

Self-signed certificates

  • If you get a xrdp certificate mismatch

Trust the Existing Self-Signed Certificate

  • Launch your Remote Desktop Connection and enter the server's hostname.
  • Click View Certificate on the security warning prompt.
  • Go to the Details tab and click Copy to File.
  • Save the .cer file to your local computer.
  • Double-click the saved .cer file, click Install Certificate, choose Local Machine, and select Place all certificates in the following store. Browse and pick the Trusted Root Certification Authorities store, then finish the import.

Hostname changed

If the hostname has changed you need to re-issue the self-signed certificate:

sudo make-ssl-cert generate-default-snakeoil --force-overwrite