XRDP on Ubuntu: A Step-by-Step Guide for Remote Desktop Access

Remote desktop functionality is essential in modern computing environments. Whether you're managing a remote server, helping a friend troubleshoot an issue, or accessing your home system while away, a reliable remote desktop solution is crucial. XRDP allows users to connect to a Linux machine like Ubuntu through Microsoft’s Remote Desktop Protocol (RDP).

This guide explains how to set up XRDP on Ubuntu, including installation, configuration, and tips for a secure and smooth remote desktop experience.

What is XRDP?

XRDP is an open-source RDP server that makes it possible for users to access Linux graphical environments via RDP clients. It acts as a bridge between the RDP protocol and the X Window System commonly used by Linux desktop environments.

Unlike VNC or SSH with X forwarding, XRDP provides a native-like desktop experience that can be accessed from any system with an RDP client.

Why Use XRDP on Ubuntu?

  • No additional client required (Windows has built-in RDP)
  • Works with multiple desktop environments like Xfce, MATE, and GNOME
  • Supports multiple sessions
  • Performs well on limited bandwidth
  • Easy to set up and maintain

Installing XRDP on Ubuntu

Step 1: System Update

sudo apt update && sudo apt upgrade -y

Step 2: Install XRDP

sudo apt install xrdp -y

Verify XRDP is running:

sudo systemctl status xrdp

Step 3: Install a Desktop Environment

If your Ubuntu installation lacks a GUI, install a lightweight environment like Xfce:

sudo apt install xfce4 xfce4-goodies -y

Step 4: Configure the Session

Tell XRDP to use Xfce:

echo "startxfce4" > ~/.xsession
chmod +x ~/.xsession

Modify XRDP start script:

sudo nano /etc/xrdp/startwm.sh

Add startxfce4 before . /etc/X11/Xsession.

Step 5: Adjust Firewall Settings

Allow RDP through the firewall:

sudo ufw allow 3389/tcp

Step 6: Restart XRDP

sudo systemctl restart xrdp

Connecting to Ubuntu Remotely

Use any RDP client (like Windows Remote Desktop). Enter the IP address of your Ubuntu machine. Login with your Ubuntu credentials and you should see the remote desktop.

Securing XRDP

  • Limit access to specific IPs using firewall rules
  • Use SSH tunneling for encrypted access
  • Configure Fail2Ban to block brute-force attacks
  • Keep software updated to patch vulnerabilities

Common Issues and Fixes

  • Black screen after login: Ensure .xsession is correctly configured
  • Connection refused: Verify XRDP is running and port 3389 is open
  • Session closes immediately: Check desktop environment compatibility

Conclusion

Setting up XRDP on Ubuntu is a practical way to access a Linux desktop remotely, using familiar tools. It's simple to install, efficient in performance, and secure when configured properly. XRDP is a powerful solution for anyone who needs stable and user-friendly remote access to an Ubuntu system.