
Enable RDP on Ubuntu 24 Using XRDP – Remote Desktop Setup
Setting up remote desktop access on Ubuntu 24 through XRDP has become essential for developers and system administrators who need GUI access to their headless servers or want to provide remote desktop capabilities for their team. XRDP is an open-source implementation of Microsoft’s Remote Desktop Protocol (RDP) that allows you to connect to Linux systems using any RDP client, including Windows Remote Desktop Connection. This guide covers the complete setup process, troubleshooting common issues, and optimization techniques to get your Ubuntu 24 system ready for remote desktop connections.
How XRDP Works on Ubuntu Systems
XRDP acts as a bridge between RDP clients and the X11 desktop environment on Linux systems. When you connect via RDP, XRDP authenticates your credentials, spawns a new X11 session, and translates RDP protocol messages to X11 commands and vice versa. Unlike VNC which shares the existing desktop session, XRDP creates individual desktop sessions for each user connection, providing better security and isolation.
The architecture consists of several components:
- XRDP daemon that listens on port 3389 for incoming RDP connections
- Session manager (sesman) that handles user authentication and session management
- X11 server that renders the desktop environment
- Desktop environment (GNOME, XFCE, KDE) that provides the user interface
Step-by-Step XRDP Installation and Configuration
Start by updating your Ubuntu 24 system and installing the required packages:
sudo apt update && sudo apt upgrade -y
sudo apt install xrdp -y
sudo systemctl enable xrdp
sudo systemctl start xrdp
Check if XRDP is running correctly:
sudo systemctl status xrdp
Install a lightweight desktop environment if your server doesn’t have one. XFCE works excellently with XRDP:
sudo apt install xfce4 xfce4-goodies -y
Configure XRDP to use XFCE by creating a startup script:
echo "xfce4-session" > ~/.xsession
sudo systemctl restart xrdp
Add the xrdp user to the ssl-cert group to allow access to certificates:
sudo adduser xrdp ssl-cert
Configure the firewall to allow RDP connections:
sudo ufw allow 3389/tcp
sudo ufw reload
Advanced Configuration and Optimization
Edit the main XRDP configuration file for better performance:
sudo nano /etc/xrdp/xrdp.ini
Modify these settings for improved performance:
[Globals]
ini_version=1
fork=true
port=3389
tcp_nodelay=true
tcp_keepalive=true
security_layer=rdp
crypt_level=high
certificate=
key_file=
ssl_protocols=TLSv1.2, TLSv1.3
max_bpp=32
xserverbpp=24
Create a custom session configuration by editing the session manager config:
sudo nano /etc/xrdp/sesman.ini
Optimize these parameters:
[Sessions]
X11DisplayOffset=10
MaxSessions=10
KillDisconnected=false
DisconnectedTimeLimit=0
IdleTimeLimit=0
[Security]
AllowRootLogin=false
MaxLoginRetry=4
TerminalServerUsers=tsusers
TerminalServerAdmins=tsadmins
Desktop Environment Compatibility and Performance
Different desktop environments perform differently with XRDP. Here’s a comparison of popular options:
Desktop Environment | Memory Usage (MB) | XRDP Compatibility | Performance Rating | Best Use Case |
---|---|---|---|---|
XFCE4 | 200-300 | Excellent | 9/10 | General purpose, development |
LXDE | 150-200 | Very Good | 8/10 | Low resource environments |
GNOME | 800-1200 | Good (with tweaks) | 6/10 | Feature-rich desktop needs |
KDE Plasma | 600-900 | Fair | 5/10 | Advanced desktop features |
For GNOME compatibility, you’ll need additional configuration:
sudo apt install gnome-session-flashback -y
echo "gnome-session-flashback-metacity" > ~/.xsession
Security Configuration and Best Practices
Implement SSL encryption for enhanced security. Generate SSL certificates:
sudo openssl req -x509 -newkey rsa:2048 -nodes -keyout /etc/xrdp/key.pem -out /etc/xrdp/cert.pem -days 365
Update the XRDP configuration to use SSL:
sudo nano /etc/xrdp/xrdp.ini
Add these SSL settings:
certificate=/etc/xrdp/cert.pem
key_file=/etc/xrdp/key.pem
security_layer=tls
Set up user access control by creating a dedicated group:
sudo groupadd xrdp-users
sudo usermod -a -G xrdp-users $USER
Configure PAM authentication for additional security:
sudo nano /etc/pam.d/xrdp-sesman
Add these authentication rules:
auth required pam_unix.so
account required pam_unix.so
session required pam_unix.so
session required pam_limits.so
Troubleshooting Common Issues
Black screen after connection usually indicates desktop environment issues. Check the session log:
tail -f ~/.xsession-errors
If you encounter authentication failures, verify the user is in the correct groups:
groups $USER
sudo usermod -a -G ssl-cert $USER
For connection timeouts, check if the service is listening:
sudo netstat -tlnp | grep :3389
sudo ss -tlnp | grep :3389
Resolve color depth issues by editing the RDP connection settings. For clipboard sharing problems, install additional packages:
sudo apt install xrdp-pulseaudio-installer -y
Audio redirection requires specific configuration:
sudo apt install pulseaudio pulseaudio-module-xrdp -y
sudo systemctl restart xrdp
Performance Optimization and Monitoring
Monitor XRDP performance and resource usage:
sudo journalctl -u xrdp -f
ps aux | grep xrdp
top -p $(pgrep -d',' xrdp)
Optimize network settings for better performance:
sudo nano /etc/sysctl.conf
Add these network optimizations:
net.core.rmem_default = 262144
net.core.rmem_max = 16777216
net.core.wmem_default = 262144
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 65536 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
Apply the changes:
sudo sysctl -p
Real-World Use Cases and Integration
XRDP excels in several scenarios. Development teams use it for accessing GUI applications on remote VPS instances, particularly when working with IDEs that require graphical interfaces. System administrators leverage XRDP for managing servers that occasionally need GUI tools for configuration or monitoring.
For automated deployment scenarios, create a setup script:
#!/bin/bash
# XRDP automated setup script
sudo apt update
sudo apt install -y xrdp xfce4 xfce4-goodies
sudo systemctl enable xrdp
sudo adduser xrdp ssl-cert
echo "xfce4-session" > ~/.xsession
sudo ufw allow 3389/tcp
sudo systemctl restart xrdp
echo "XRDP setup completed successfully"
Educational institutions often deploy XRDP on dedicated servers to provide students with remote access to development environments, eliminating the need for complex local software installations.
Alternative Solutions and Comparisons
While XRDP provides excellent RDP compatibility, consider these alternatives based on your specific needs:
Solution | Protocol | Performance | Ease of Setup | Client Support |
---|---|---|---|---|
XRDP | RDP | Good | Medium | Excellent (Windows native) |
VNC (TigerVNC) | VNC | Fair | Easy | Good (cross-platform) |
NoMachine NX | NX | Excellent | Easy | Good (proprietary client) |
Chrome Remote Desktop | Proprietary | Good | Very Easy | Limited (browser-based) |
XRDP’s main advantage lies in its native Windows RDP client support, making it ideal for mixed Windows-Linux environments. The session isolation and multi-user capabilities make it superior to VNC for multi-user scenarios.
For additional configuration options and advanced features, consult the official XRDP documentation at https://github.com/neutrinolabs/xrdp and the Ubuntu community documentation at https://help.ubuntu.com/community/xrdp.
Remember to regularly update your XRDP installation and monitor security advisories, as remote desktop services can be attractive targets for attackers. Implement proper firewall rules, use strong authentication, and consider VPN access for additional security layers in production environments.

This article incorporates information and material from various online sources. We acknowledge and appreciate the work of all original authors, publishers, and websites. While every effort has been made to appropriately credit the source material, any unintentional oversight or omission does not constitute a copyright infringement. All trademarks, logos, and images mentioned are the property of their respective owners. If you believe that any content used in this article infringes upon your copyright, please contact us immediately for review and prompt action.
This article is intended for informational and educational purposes only and does not infringe on the rights of the copyright owners. If any copyrighted material has been used without proper credit or in violation of copyright laws, it is unintentional and we will rectify it promptly upon notification. Please note that the republishing, redistribution, or reproduction of part or all of the contents in any form is prohibited without express written permission from the author and website owner. For permissions or further inquiries, please contact us.