Installing and Configuring XRDP on Ubuntu 24.04 with GNOME or LXDE

XRDP is an open-source tool that facilitates remote desktop access to Linux systems using the Remote Desktop Protocol (RDP). This guide will walk you through setting up XRDP on Ubuntu 24.04 with two popular desktop environments: GNOME and LXDE.

Option 1: XRDP with GNOME Desktop

Update Your System

Ensure your system is up-to-date with the latest packages:

apt update -y && sudo apt upgrade -y

Install GNOME Desktop Environment

If GNOME is not already installed, you can install it with,

apt install ubuntu-gnome-desktop -y

Install and Enable XRDP

Install XRDP using,

apt install xrdp -y

Enable and start the XRDP service,

systemctl enable xrdp
systemctl start xrdp

Configure XRDP to Use GNOME

Create or modify the .xsession file in your home directory:

echo gnome-session > ~/.xsession

Allow XRDP Through the Firewall

Open port 3389 for XRDP traffic:

ufw allow 3389/tcp

Configure Polkit Rules

To prevent authentication issues, set up Polkit rules by creating the file /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf,

nano /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf

Add the following content,

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.color-manager.create-device" ||
        action.id == "org.freedesktop.color-manager.create-profile" ||
        action.id == "org.freedesktop.color-manager.delete-device" ||
        action.id == "org.freedesktop.color-manager.delete-profile" ||
        action.id == "org.freedesktop.color-manager.modify-device" ||
        action.id == "org.freedesktop.color-manager.modify-profile") {
        return polkit.Result.YES;
    }
});

Restart the XRDP Service

Apply changes by restarting XRDP,

systemctl restart xrdp

Connect to the XRDP Server

Use an RDP client to connect to your Ubuntu 24.04 machine. Enter the IP address or hostname, and log in with your Ubuntu credentials to access the GNOME desktop environment.

images

images

Option 2: XRDP with LXDE Desktop

LXDE is a lightweight desktop environment, ideal for systems with limited resources or for a faster remote desktop experience.

Install LXDE Install the LXDE desktop environment,

apt install lxde -y

Install XRDP

apt install xrdp -y

Configure XRDP to Use LXDE

Edit the XRDP startup script,

nano /etc/xrdp/startwm.sh

Add the following lines before the existing line,

#!/bin/sh
if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
fi

startlxde

Restart the XRDP Service

Apply the changes by restarting XRDP:

systemctl restart xrdp

Allow XRDP Through the Firewall

Open port 3389 and reload the firewall rules,

ufw allow 3389/tcp
ufw enable
ufw reload

Connect to XRDP

Use a Remote Desktop Client to connect to your Ubuntu machine. Enter the IP address of your Ubuntu system and use your Ubuntu username and password.

images

images

Done, You've successfully set up XRDP on your Ubuntu 24.04 system. Whether you're working with GNOME's modern interface or LXDE's lightweight charm, you can now enjoy seamless remote access from anywhere. Happy remote desktop-ing!