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 -yStep 2: Install XRDP
sudo apt install xrdp -yVerify XRDP is running:
sudo systemctl status xrdpStep 3: Install a Desktop Environment
If your Ubuntu installation lacks a GUI, install a lightweight environment like Xfce:
sudo apt install xfce4 xfce4-goodies -yStep 4: Configure the Session
Tell XRDP to use Xfce:
echo "startxfce4" > ~/.xsession
chmod +x ~/.xsessionModify XRDP start script:
sudo nano /etc/xrdp/startwm.shAdd startxfce4 before . /etc/X11/Xsession.
Step 5: Adjust Firewall Settings
Allow RDP through the firewall:
sudo ufw allow 3389/tcpStep 6: Restart XRDP
sudo systemctl restart xrdpConnecting 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
.xsessionis 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.