How to Enable Remote Desktop Protocol Using XRDP on Ubuntu

How to Enable Remote Desktop Protocol Using XRDP on Ubuntu: Step-by-Step Guide

How to enable Remote Desktop Protocol using XRDP on Ubuntu? Remote Desktop Protocol (RDP) is a convenient way to connect to and manage a computer remotely. While RDP is native to Windows, Ubuntu users can also enjoy this functionality using XRDP, an open-source implementation of RDP for Linux. XRDP allows you to access your Ubuntu desktop from a Windows machine or any other device that supports RDP. This guide will walk you through the steps to enable RDP using XRDP on Ubuntu, ensuring a seamless remote desktop experience.

Why Use XRDP on Ubuntu?

XRDP provides several advantages for Ubuntu users:

  • Cross-Platform Compatibility: Access your Ubuntu desktop from Windows, macOS, or any other device with RDP support.
  • Ease of Use: Once set up, XRDP allows you to log in to your Ubuntu desktop with the same experience as being physically present at the machine.
  • Lightweight: XRDP is lightweight, making it a suitable option even for older machines or limited-resource environments.

Prerequisites

Before enabling XRDP on Ubuntu, ensure you have the following:

  1. Ubuntu 18.04 or later: This guide focuses on recent versions of Ubuntu, but the steps are similar for other distributions.
  2. A non-root user with sudo privileges: You will need sudo access to install and configure XRDP.
  3. A working network connection: Ensure both your Ubuntu machine and the remote device are connected to the internet or a local network.

Step-by-Step Guide How to Enable Remote Desktop Protocol Using XRDP on Ubuntu?

Step 1: Update Your System

Before installing any new software, it’s good practice to update your system to ensure you have the latest packages and security patches.

bash   Copy code
sudo apt update && sudo apt upgrade -y

Step 2: Install the Desktop Environment (Optional)

Ubuntu servers typically don’t come with a desktop environment by default. If you’re working with a server version of Ubuntu, you’ll need to install a desktop environment like XFCE, which is lightweight and works well with XRDP.

bash   Copy code
sudo apt install xfce4 xfce4-goodies -y

Once the installation is completed, you can continue to the next step.

Step 3: Install XRDP

With your system updated and the desktop environment installed, it’s time to install XRDP.

bash   Copy code
sudo apt install xrdp -y

Step 4: Configure XRDP

After installing XRDP, you’ll need to configure it to use the XFCE desktop environment (or another desktop environment if you prefer).

  1. Configure XRDP to use XFCE:
    bash   Copy code
    echo "xfce4-session" | sudo tee /etc/xrdp/startwm.sh

    This command replaces the default startup script with one that starts the XFCE session.

  2. Add XRDP to the ssl-cert group:
    bash   Copy code
    sudo adduser xrdp ssl-cert

    This command adds the XRDP user to the ssl-cert group, which is necessary for using SSL certificates with XRDP.

  3. Restart XRDP:
    bash   Copy code
    sudo systemctl restart xrdp

    Restarting XRDP ensures that all changes are applied.

Step 5: Allow RDP Through the Firewall

To allow remote connections to your Ubuntu machine, you need to adjust the firewall settings.

bash   Copy code
sudo ufw allow 3389/tcp

The above command allows traffic on port 3389, which is the default port for RDP. If you’re using a different firewall or port, adjust the command accordingly.

Step 6: Connect to Ubuntu via RDP

With XRDP installed and configured, you’re now ready to connect to your Ubuntu machine remotely.

  1. Find the IP Address of Your Ubuntu Machine:
    bash   Copy code
    hostname -I

    Note down the IP address returned by this command.

  2. Connect Using a Remote Desktop Client:
    • On-Windows: Open the Remote Desktop Connection app, enter the IP address of your Ubuntu machine, and click “Connect.”
    • On-macOS: Use the Microsoft Remote Desktop app available from the App Store.
    • On-Linux: Use an RDP client like Remmina or KRDC.
  3. Log In: When prompted, enter your Ubuntu username and password. You should now be connected to your Ubuntu desktop via RDP.

Step 7: Optional Configurations

Customizing XRDP Sessions
You can further customize XRDP sessions by editing the xrdp.ini file located in /etc/xrdp/. Here, you can adjust settings like the port number, security settings, and more.

bash   Copy code
sudo nano /etc/xrdp/xrdp.ini

After making any changes, remember to restart XRDP:

bash   Copy code
sudo systemctl restart xrdp

Setting a Static IP Address
For a consistent connection experience, especially if you’re connecting over a local network, consider setting a static IP address for your Ubuntu machine. This ensures that the IP address doesn’t change, making it easier to connect.

Troubleshooting Common Issues

1. Black Screen After Logging In
If you encounter a black screen after logging in, it may be due to a misconfiguration in the desktop environment settings. Ensure that startwm.sh is correctly pointing to your desired desktop environment (e.g., XFCE).

2. XRDP Connection Refused
If you receive a “connection refused” error, check that XRDP is running:

bash   Copy code
sudo systemctl status xrdp

If it’s not running, start the service and enable it to start on boot:

bash   Copy code
sudo systemctl start xrdp
sudo systemctl enable xrdp

3. Slow Performance
If you experience slow performance during the remote session, consider reducing the color depth or disabling features like font smoothing in the remote desktop client settings.

Conclusion

Enabling Remote Desktop Protocol on Ubuntu using XRDP is a powerful way to remotely manage your Linux machine from anywhere. Whether you’re a system administrator, developer, or a casual user, this guide provides all the steps needed to set up XRDP on your Ubuntu system. By following these instructions, you’ll enjoy seamless, secure access to your desktop environment from any device that supports RDP. Remember to keep your system updated and configure XRDP securely to protect your remote connections.

Scroll to Top