Use Remote Desktop in Linux with XRDP

Share on Social Media

Learn how to use remote desktop in Linux systems using XRDP. This step-by-step guide covers installation, configuration, troubleshooting, and optimizing XRDP for seamless remote desktop connections from any device. Perfect for Linux admins and remote workers! #centlinux #linux #xrdp



What is XRDP?

Introduction to XRDP

XRDP is an open-source implementation of Microsoft’s Remote Desktop Protocol (RDP) that allows users to remotely access Linux systems from virtually any device, including Windows, macOS, and Android. It’s particularly popular for its ease of integration with Linux distributions and its ability to deliver a seamless remote desktop experience.

Overview and Purpose

XRDP is designed to bridge the gap between different operating systems, making it easier for users to connect and control Linux systems without requiring proprietary software. It achieves this by using standard RDP clients, which are often pre-installed on most devices.

How XRDP Works

When a user connects via XRDP, the system creates a virtual display session on the Linux server. This session is then rendered and transmitted through the RDP client. Unlike traditional protocols like VNC, XRDP optimizes performance by reducing bandwidth usage and supporting multiple user sessions simultaneously.

Use Remote Desktop in Linux with XRDP

Benefits of Using XRDP

Cross-Platform Compatibility

One of XRDP’s standout features is its compatibility with a wide range of operating systems. Users can connect to Linux from Windows, macOS, or even mobile devices, ensuring flexibility in remote work or system management.

Lightweight and Efficient

XRDP is lightweight compared to alternatives like VNC, making it ideal for resource-constrained environments. It consumes less bandwidth and offers smoother performance, even over slower network connections.


Setting Up XRDP on Linux

Prerequisites for Installation

Supported Distributions

XRDP supports many popular Linux distributions, including Ubuntu, Debian, Fedora, and CentOS. However, users should ensure that their version is up-to-date to avoid compatibility issues.

Required Software Packages

Before installing XRDP, users need essential packages like xrdp, a desktop environment (e.g., XFCE, GNOME), and SSH for remote configuration. Ensure the system has root privileges for installation.

Step-by-Step Installation Guide

Installing XRDP on Ubuntu

Update your system:

sudo apt update && sudo apt upgrade

Install XRDP on Ubuntu.

sudo apt install xrdp

Enable and start the XRDP service:

sudo systemctl enable xrdp 
sudo systemctl start xrdp

Once installed, configure XRDP to use a desktop environment like XFCE:

Install XFCE:

sudo apt install xfce4 xfce4-goodies

Set XFCE as the default:

echo "xfce4-session" > ~/.xsession

Read Also: 10 Practical Tasks for RHCSA Exam

Installing XRDP on Rocky Linux 9

Configuring XRDP on Rocky Linux 9 enables remote desktop access, allowing you to manage your system graphically from another device. Follow these steps to set up XRDP:

Ensure all packages are up-to-date:

sudo dnf update -y

The Extra Packages for Enterprise Linux (EPEL) repository provides additional software packages, including XRDP:

sudo dnf install -y epel-release

With the EPEL repository enabled, install XRDP and the TigerVNC server:

sudo dnf install -y xrdp tigervnc-server

If your system lacks a graphical interface, install one. For a lightweight option, consider Xfce:

sudo dnf groupinstall -y "Xfce"

Create a .Xclients file to specify Xfce as the session manager:

echo "exec /usr/bin/xfce4-session" > ~/.Xclients
chmod +x ~/.Xclients

Configure XRDP to start on boot and initiate the service:

sudo systemctl enable xrdp --now

Ensure the system boots into the graphical target by default:

sudo systemctl set-default graphical.target

Restart your system to apply all changes:

sudo reboot

After rebooting, use an RDP client (such as Remote Desktop Connection on Windows) to connect to your Rocky Linux 9 machine by entering its IP address. Log in with your system credentials to access the desktop environment.

By following these steps, you can establish a remote desktop connection to your Rocky Linux 9 system using XRDP.

Troubleshooting Installation Issues

Common issues during installation may include unmet dependencies or conflicts with pre-installed desktop environments. Resolving these often requires ensuring all packages are updated and compatible.


Configuring XRDP for Seamless Use

Adjusting Firewall Settings

To ensure XRDP works properly, allow its default port (3389) through the firewall:

For Ubuntu:

sudo ufw allow 3389/tcp
sudo ufw reload

For Rocky Linux 9:

sudo firewall-cmd --permanent --add-port=3389/tcp
sudo firewall-cmd --reload

Selecting a Desktop Environment

Not all desktop environments work seamlessly with XRDP. Lightweight environments like XFCE are recommended for their stability and performance. GNOME and KDE can work but might require additional configuration.


Configuring XRDP for Seamless Use

Optimizing Performance for Remote Sessions

Bandwidth Management

To improve remote session performance, especially on slower networks, users can tweak XRDP settings. Enable compression and reduce the color depth for remote sessions. This can be configured in the RDP client by selecting lower visual quality and limiting resource-heavy features like desktop backgrounds.

Security Enhancements

Security is critical when accessing systems remotely. XRDP can be secured further by enabling SSL encryption for data transmission. Configure xrdp.ini to use secure certificates, and consider using SSH tunneling to add another layer of security. Regularly update XRDP to address potential vulnerabilities.


Advanced Features of XRDP

Multi-User Support

XRDP allows multiple users to connect to the same server simultaneously, each with their own sessions. This is particularly useful for shared servers or multi-user environments where collaboration or parallel work is necessary.

Customizing XRDP Login Interface

Users can personalize the XRDP login screen by editing the xrdp.ini file. Changes include adding custom branding, modifying login prompts, or pre-selecting frequently used desktop environments.

Using XRDP with SSH Tunneling

For enhanced security, XRDP sessions can be routed through an SSH tunnel. This encrypts all traffic between the client and server:

Establish an SSH tunnel:

ssh -L 3389:localhost:3389 user@server-ip

Connect to localhost:3389 on your RDP client.


Common Issues and How to Fix Them

XRDP Session Crashes

Session crashes are often caused by conflicts between XRDP and the desktop environment. Switching to a lightweight environment like XFCE or reinstalling XRDP usually resolves the issue.

Black Screen Issue After Login

A common complaint with XRDP is the “black screen” problem. This is often due to an unsupported desktop environment or misconfigured .xsession file. Ensure the file includes the correct desktop session, like xfce4-session.

Keyboard Layout Issues

Mismatched keyboard layouts between the client and server can cause typing errors. Set the desired layout in the xrdp.ini file or configure it during the desktop session.


Alternatives to XRDP

Comparison with VNC

While XRDP uses the RDP protocol, VNC relies on its own proprietary protocol. VNC offers direct desktop sharing but lacks the multi-user support and efficiency of XRDP. XRDP is better suited for managing remote Linux systems.

RDP Solutions from Microsoft

Microsoft’s RDP solutions are more tightly integrated with Windows systems. However, they don’t natively support Linux. XRDP fills this gap by providing RDP support on Linux.

Other Open-Source Remote Desktop Protocols

Options like NoMachine and TigerVNC are viable alternatives. Each has unique features, but XRDP stands out for its compatibility with standard RDP clients.


Conclusion and Final Thoughts

Why XRDP Stands Out

XRDP offers a simple, lightweight, and efficient solution for remote desktop access to Linux systems. Its seamless integration with existing RDP clients and multi-user support make it a go-to choice for Linux administrators and remote workers alike.

Ideal Use Cases for XRDP

Whether managing servers, working remotely, or troubleshooting Linux systems, XRDP is a versatile tool that caters to a wide range of scenarios. Its flexibility and reliability ensure that users can access their systems securely and efficiently.

If you are Looking for a reliable Linux system admin? I offer expert management, optimization, and support for all your Linux server needs, ensuring smooth and secure operations. Have a look at my Fiverr Profile.


Frequently Asked Questions (FAQs)

  1. What is the difference between XRDP and VNC?
    XRDP uses the RDP protocol, making it more efficient and compatible with existing RDP clients, while VNC is focused on screen sharing.
  2. Can XRDP be used on Windows?
    No, XRDP is designed for Linux systems. However, you can use it to connect to Linux from Windows.
  3. How secure is XRDP for remote access?
    XRDP is secure when used with SSL encryption or SSH tunneling, ensuring that data is transmitted securely.
  4. What desktop environments work best with XRDP?
    Lightweight environments like XFCE and MATE work best, as they are less resource-intensive and more stable with XRDP.
  5. Is XRDP free to use?
    Yes, XRDP is open-source and free for personal and commercial use.

Leave a Comment