1080*80 ad

Setting Up XRDP on Ubuntu 24.04 for Remote Desktop

Unlock Remote Desktop on Ubuntu 24.04: A Complete Guide to Installing XRDP

Gaining remote graphical access to your Ubuntu machine opens up a world of possibilities, from managing servers with a familiar desktop interface to accessing your development environment from anywhere. While SSH is perfect for command-line work, a full remote desktop provides a more intuitive and visual experience.

This is where XRDP comes in. XRDP is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to control a Linux desktop from a Windows machine, another Linux box, or even a Mac.

This comprehensive guide will walk you through every step of installing and configuring XRDP on Ubuntu 24.04 Noble Numbat, ensuring a secure, stable, and seamless remote connection.

Prerequisites

Before we begin, ensure you have the following:

  • An installed instance of Ubuntu 24.04.
  • A user account with sudo or root privileges.
  • A basic understanding of the command line.

Step 1: Update Your System

First things first, it’s always a best practice to ensure your system’s package list and installed packages are up to date. This prevents potential conflicts and security vulnerabilities.

Open your terminal and run the following commands:

sudo apt update
sudo apt upgrade -y

Step 2: Install a Desktop Environment

While Ubuntu 24.04 comes with the modern GNOME desktop, XRDP often performs more reliably and with fewer resources when paired with a lighter desktop environment. For this reason, we highly recommend installing the XFCE4 Desktop Environment. It’s lightweight, fast, and known for its excellent compatibility with XRDP.

To install XFCE, execute this command:

sudo apt install xfce4 xfce4-goodies -y

This command installs the core XFCE desktop along with some helpful plugins and enhancements.

Step 3: Install the XRDP Server

With our desktop environment in place, we can now install the XRDP server software itself. The package is available directly from Ubuntu’s official repositories.

sudo apt install xrdp -y

Once the installation is complete, the XRDP service should start automatically. You can verify its status with the following command:

sudo systemctl status xrdp

You should see an active (running) status in green, confirming that the service is operational.

Step 4: Configure XRDP and User Permissions

For XRDP to function correctly and securely, it needs permission to access certain system files. By default, the RDP protocol uses a certificate key file that is readable only by members of the ssl-cert group. We need to add the xrdp user to this group.

This is a crucial step for establishing a secure connection.

sudo adduser xrdp ssl-cert

Next, we need to tell XRDP which desktop environment to launch when a user connects. We’ll configure it to use the XFCE session we installed earlier. Create or edit the .xsession file in your home directory to specify this.

echo "xfce4-session" | tee ~/.xsession

This command sets XFCE as the default session for your user when connecting via XRDP.

Step 5: Configure Your Firewall

Security should never be an afterthought. Your server’s firewall is likely blocking incoming connections by default. We need to create a rule to allow traffic on the standard RDP port, port 3389.

If you are using UFW (Uncomplicated Firewall), which is standard on Ubuntu, you can allow the port with this command:

sudo ufw allow 3389/tcp

Security Tip: For enhanced security, it’s highly recommended to restrict access to only your specific IP address or a trusted IP range. This prevents unauthorized connection attempts from the open internet. You can do this by running:

sudo ufw allow from YOUR_IP_ADDRESS to any port 3389

Replace YOUR_IP_ADDRESS with your actual public IP. After adding the rule, reload the firewall to apply the changes:

sudo ufw reload

Step 6: Restart XRDP and Connect

To ensure all our configuration changes take effect, it’s best to restart the XRDP service.

sudo systemctl restart xrdp

Your Ubuntu 24.04 machine is now ready to accept remote desktop connections!

To connect, you will need your server’s IP address. You can find it by running:

ip a

Now, from your client machine (e.g., a Windows PC), open the Remote Desktop Connection application. Enter your Ubuntu server’s IP address and click “Connect.” You will be presented with the XRDP login screen. Enter your Ubuntu username and password to start your remote session.

Common Troubleshooting Tips

If you encounter a blank screen or connection issues, here are a few common fixes:

  1. Authentication Dialog Box: A known issue with Ubuntu’s default color management policy can prevent the authentication dialog from appearing. You can fix this by creating a policy file to allow it for all users.
    bash
    sudo nano /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla

    Paste the following content into the file, then save and exit:
    ini
    [Allow Colord all Users]
    Identity=unix-user:*
    Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
    ResultAny=no
    ResultInactive=no
    ResultActive=yes
  2. Check Firewall Rules: Double-check that your firewall is correctly configured and allowing traffic on port 3389 from your specific IP address.
  3. Restart Services: Sometimes, a simple restart of the XRDP service (sudo systemctl restart xrdp) is all that’s needed to resolve a temporary glitch.

By following these steps, you have successfully set up a powerful and convenient remote desktop server on your Ubuntu 24.04 system, empowering you to manage your machine graphically from anywhere in the world.

Source: https://infotechys.com/install-xrdp-on-ubuntu-24-04/

900*80 ad

      1080*80 ad