← Module 10: Swap & Performance | Back to Course Home | Next Module: Applications & Monitoring →
By the end of this module you will be able to:
- Install the Xfce lightweight desktop environment on Ubuntu Server
- Install and start the xrdp service
- Configure xrdp and set the session manager
- Connect to the server graphically from Windows, macOS, or Linux
- Troubleshoot common xRDP connection issues
Estimated time: 45 minutes
xRDP is an open-source implementation of Microsoft's Remote Desktop Protocol (RDP) for Linux. It allows you to connect to a Linux server's graphical desktop using the standard Windows Remote Desktop client or any compatible RDP application.
| Reason | Detail |
|---|---|
| Familiar interface | Uses the same RDP protocol as Windows Remote Desktop |
| Graphical administration | Run GUI applications on the server from anywhere |
| Low bandwidth | RDP compresses the display efficiently |
| Cross-platform | Clients available for Windows, macOS, Linux, iOS, Android |
xRDP uses port 3389 by default. Ensure this port is open in UFW before connecting.
Always update before installing new software:
sudo apt update && sudo apt upgrade -yUbuntu Server has no graphical interface by default. Xfce is a lightweight, fast desktop environment well suited for server use.
sudo apt install xfce4 xfce4-goodies -yDuring installation you may be asked to choose a display manager. Select lightdm for a lightweight option or leave the default and press Enter.
Installation downloads approximately 200–400 MB and takes several minutes.
sudo apt install xrdp -yAfter installation, verify xrdp is running:
sudo systemctl status xrdpExpected output includes:
● xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; ...)
Active: active (running) since ...
If xrdp is not running, start it:
sudo systemctl start xrdpEnable it to start automatically at boot:
sudo systemctl enable xrdpCreate a .xsession file in your home directory to specify which desktop environment xrdp should launch:
echo "xfce4-session" | tee ~/.xsessionThis tells xrdp to start an Xfce session when you connect. Without this file, the RDP connection will open a blank or broken session.
Restart xrdp to apply the configuration:
sudo systemctl restart xrdpAllow RDP traffic through the UFW firewall:
sudo ufw allow 3389Verify the rule was added:
sudo ufw statusip addr showNote the inet address (e.g., 192.168.1.105). You will use this in your RDP client.
- Press Win+R, type
mstsc, and press Enter - In the Remote Desktop Connection window, enter your server's IP address
- Click Show Options if you want to pre-fill the username
- Click Connect
- Accept the certificate warning (click Yes or Connect Anyway)
- In the xRDP login screen, enter your Ubuntu username and password
- Click OK
You should now see the Xfce desktop:
- Install Microsoft Remote Desktop from the Mac App Store
- Click + → Add PC
- Enter the server's IP address as the PC Name
- Click Add
- Double-click the new PC entry and enter your credentials
Install remmina:
sudo apt install remmina remmina-plugin-rdp -yOpen Remmina, create a new connection:
- Protocol: RDP
- Server:
192.168.1.105 - Username: your Ubuntu username
- Password: your Ubuntu password
The xrdp configuration file is at /etc/xrdp/xrdp.ini:
sudo nano /etc/xrdp/xrdp.iniKey configuration sections:
| Section | Purpose |
|---|---|
[Globals] |
Port, max sessions, log level |
[Logging] |
Log file location and verbosity |
[Channels] |
Clipboard, audio, drive redirection |
[Xorg] |
Session type (Xorg, used by default) |
Default port is 3389. To change it, update the port= value under [Globals] and remember to update the firewall rule.
| Problem | Cause | Solution |
|---|---|---|
| Connection refused | xrdp not running | sudo systemctl start xrdp |
| Blank / black screen | No session manager set | Verify ~/.xsession contains xfce4-session |
| "Authentication is required" popup | polkit agent issue | Install xfce4-polkit or dismiss the popup |
| Slow performance | High latency or low bandwidth | Lower colour depth in RDP client settings |
| Port 3389 blocked | UFW blocking | sudo ufw allow 3389 |
| Certificate error | Self-signed cert (normal) | Accept / trust the certificate in the RDP client |
sudo tail -50 /var/log/xrdp.log
sudo tail -50 /var/log/xrdp-sesman.log- xrdp provides an RDP server for Linux, enabling graphical remote desktop access
- Install Xfce as the desktop environment before installing xrdp
- Create
~/.xsessioncontainingxfce4-sessionto set the session manager - Open port 3389 in UFW before attempting to connect
- Connect from Windows with the built-in Remote Desktop Connection (
mstsc), from macOS with Microsoft Remote Desktop, and from Linux with Remmina
- What port does xRDP use by default?
- Why do you need to create the
~/.xsessionfile? - What command verifies that xrdp is running?
- How do you open the Windows Remote Desktop client?
- Where are xRDP log files stored?
(Answers: 1. Port 3389 | 2. It tells xrdp which desktop session to launch; without it, the session fails or shows a blank screen | 3. sudo systemctl status xrdp | 4. Press Win+R, type mstsc, press Enter | 5. /var/log/xrdp.log and /var/log/xrdp-sesman.log)
← Module 10: Swap & Performance | Back to Course Home | Next Module: Applications & Monitoring →

