Get 50% Discount Offer 26 Days

Recommended Services
Supported Scripts
WordPress
Hubspot
Joomla
Drupal
Wix
Shopify
Magento
Typeo3
How to Enable RDP Access on Ubuntu 24 using xRDP

This guide details enabling Remote Desktop Protocol (RDP) access on Ubuntu 24, covering installation, configuration, troubleshooting, and advanced security practices. Whether you’re a beginner or an advanced user, this guide will show you how to set up RDP securely and efficiently.

1. Introduction to RDP on Ubuntu

What is RDP?

Remote Desktop Protocol (RDP) provides connections to a computer in a graphical interface. Microsoft originally built RDP, but it is very widely used in enterprise and personal environments to access files or software on another machine remotely.

RDP provides a smoother and more secure experience than traditional command-line tools like SSH. With Ubuntu 24, enabling RDP bridges the gap between Linux and other platforms like Windows.

Advantages of Using RDP on Ubuntu

  • Cross-Platform Access: With RDP with your Ubuntu system, you can connect from any device, including Windows PCs, macOS, and Linux.
  • Graphical Interface: RDP is not a command line like SSH but provides you with a complete graphical environment to operate on, hence making remote management very user-friendly or intuitive.
  • Increased Productivity: Allows IT professionals to troubleshoot and manage remote systems easily. Remote workers can also use RDP to access on-premises resources.

Prerequisites for Enabling RDP

Updated Ubuntu 24 Installation: Make sure your system is fully updated with:

sudo apt update && sudo apt upgrade -y
command to update an Ubuntu 24 system using apt update and apt upgrade
  • Administrator Privileges: You’ll need sudo access to install software and modify configurations.
  • Internet Connection: A fast, stable connection is recommended for remote access.

2. Installing RDP Software

Default Ubuntu Tools

  • VNC (Virtual Network Computing) is included as a built-in feature in Ubuntu, but RDP (Remote Desktop Protocol) is excluded by default. However, for simple use cases, VNC works well, but RDP performs better and integrates well with Windows clients.

Checking for Pre-Installed Tools:

Before installing an RDP server, verify if any remote tools are installed using dpkg -l | grep remote. This command lists all remote-related packages, including SSH or XRDP. If no RDP-related package is found, install an RDP server like XRDP for remote desktop access.

dpkg -l | grep remote
Terminal output showing the results of the dpkg -l | grep remote command
  • If no RDP server is listed, proceed to install xrdp.

Installing XRDP

xrdp is the most popular open-source RDP server for Linux. To install:

sudo apt update
Terminal output showing the process of updating the package list
sudo apt install xrdp -y
Terminal output showing the installation process and additional packages being installed

After installation, verify the XRDP service is running:

sudo systemctl status xrdp
Terminal output showing the status of the XRDP service and its active state

If inactive, start it with:

sudo systemctl start xrdp
Terminal output showing the execution of the systemctl start xrdp command

Installing Alternative RDP Servers

If you are a user who would like to obtain solutions to the default XRDP server, there are several ways to go. For instance, if you know what kind of features you need, you can always prefer those options that offer more and more features. The two options in the list below are popular:

  • FreeRDP: FreeRDP is a robust alternative to XRDP, designed to offer advanced features and better compatibility for a wide range of use cases. It gives you flexible configurations and added functionality for remote desktop protocols, making it a great choice for power users and those who require specialized granular flow control of their remote desktop environment.

To install FreeRDP, use the following command:

sudo apt install freerdp2-x11 -y

This command ensures that the required FreeRDP packages are installed on your system. The—y flag automatically confirms the installation process.

Terminal output showing the installation process and additional packages being installed
  • x2go: x2go is another great option if you need a highly efficient remote desktop solution. It is good for designers, video editors, and other graphical workloads. Unlike some other remote desktop solutions, x2go focuses on providing a seamless and responsive experience over low-bandwidth connections.

To install x2go, run the following command:

sudo apt install x2goserver x2goserver-xsession -y

This command installs the core server components for x2go and additional packages necessary for managing x2go sessions.

command to install x2go server components on Ubuntu using the apt package manager

3. Configuring XRDP on Ubuntu 24

After the installation, some configuration steps are necessary to maximize XRDP. By default, XRDP uses a standard configuration, but you may need to edit specific settings or files to match your environment and requirements.

Editing the Configuration File

To make sure XRDP is good for the setup, we’ll adjust the configuration file. If that process involves specifying authentication settings, enabling support for multiple conversations, or tuning for performance, as it often does, it may take a long time.

Use a Text editor like nano to make the necessary adjustments.

sudo nano /etc/xrdp/xrdp.ini
Editing XRDP Configuration

Necessary fields to configure:

Port Configuration

XRDP listens on port 3389 by default. While this is functional out of the box, changing this port for custom setups is advisable to enhance security and reduce the risks of unauthorized access or automated attacks targeting the default RDP port.

Configuring XRDP Listening Port

Encryption

Configuring the encryption settings in the xrdp.ini file is crucial to confirm a secure and encrypted connection when using XRDP. Encryption protects sensitive data from being intercepted during transmission when connecting to your server over public or insecure networks.

security_layer=rdp
Configuring XRDP Security
crypt_level=high
Setting High Encryption Level in XRDP
  • After editing, restart XRDP:

Once you’ve made any changes to the XRDP configuration files (such as modifying port settings, encryption options, or other parameters), restarting the XRDP service is essential to applying the updates.

sudo systemctl restart xrdp
Applying XRDP Configuration Changes
  • Adjusting Session Settings

You may need to modify the session startup configuration to ensure a seamless experience and avoid session conflicts. This process is particularly important if you use a custom desktop environment or face issues like duplicate or failing sessions.

To avoid session conflicts, edit /etc/xrdp/startwm.sh 

startwm.sh file with editable configuration options

and confirm it launches your desired desktop environment. For example:

unset DBUS_SESSION_BUS_ADDRESS
Terminal window showing command to unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4
  • Always restart the service after making changes.

Adding Custom Ports (Optional)

  • For additional security, you can change the RDP port:

Edit /etc/xrdp/xrdp.ini:

port=3390
Editing xrdp configuration file to change port
  • Update your firewall:
sudo ufw allow 3390
Allowing RDP port 3390 through firewall

4. Setting Up a Desktop Environment for RDP

Ubuntu Server installations typically lack a graphical desktop environment, as they are optimized for command-line operations. To enable remote desktop functionality, XRDP must install a desktop environment that can provide graphical access.

Installing Desktop Environments

For RDP access, it’s best to install a lightweight desktop environment that is optimized for remote connections. A commonly recommended option is XFCE, which balances functionality and performance well.

XFCE (lightweight):

sudo apt install xfce4 xfce4-goodies -y
Installing XFCE desktop environment using apt package manager

GNOME (default for Ubuntu):

Ubuntu Desktop installations often come with GNOME as the default desktop environment. If you use an Ubuntu Server setup or need to install GNOME manually, follow the steps below.

Installing GNOME (Default for Ubuntu)

GNOME provides a feature-rich and visually appealing desktop environment suitable for users who prefer a more modern interface. To install GNOME, run the following command:

sudo apt install ubuntu-desktop -y
Installing GNOME desktop environment using apt package manager
  • Configure XRDP to use the installed desktop.

Configuring XRDP for Specific Desktop Environments

Edit /etc/xrdp/startwm.sh to set the desktop environment:

startxfce4
  • Test by connecting via RDP after restarting the XRDP service.

How to connect to your RDP

When connecting to the remote server via RDP, you may see a security warning stating: “The publisher of this remote connection can’t be identified.” This error occurs because XRDP uses a self-signed certificate by default. To proceed, click Connect or suppress future warnings by checking “Don’t ask me again for connections to this computer.”

Remote Desktop Connection security warning about unknown publisher

When initiating a remote desktop connection, the RDP client communicates with the server at the specified address and port (e.g., vinayak.voxfor.com:3390). The connection process involves verifying server availability, initiating the handshake, and setting up the graphical session. Once thriving, the remote desktop interface will appear, granting access to the server environment.

Remote Desktop Connection process, including server verification and handshake

When connecting via RDP, a warning may appear stating“The remote computer’s identity cannot be verified.” This warning occurs due to certificate issues like a name mismatch or an untrusted certificate authority. Despite the warning, you can proceed by clicking “Yes” or checking “Don’t ask me again” to suppress future prompts for this connection.

Remote Desktop Connection security warning about certificate name mismatch

When successfully connected via XRDP, you will see a login screen similar to the one shown. Select your preferred session type (e.g., Xorg), enter your server username and password, and click OK. This grants access to the remote desktop environment configured for your server.

Remote Desktop login screen prompting for username, password, and session type

When logging into XRDP, select your session type, such as Xorg, and enter your username (e.g., root) and the corresponding password. Once authenticated, click OK to access the configured desktop environment on the remote server. This grants you complete remote control over the server’s GUI interface.

Remote Desktop login screen prompting for username, password, and session type

This screen indicates the successful establishment of a remote desktop session. It shows the welcome setup wizard for your desktop environment, prompting you to select language preferences and other initial configurations. Follow the steps by clicking Next to complete the setup and access your entire desktop interface. This process marks the final stage of enabling RDP on your server.

Initial setup wizard for remote desktop environment

5. Managing Firewalls and Port Forwarding

Allowing RDP through UFW

Check if the default RDP port (3389) is open:

sudo ufw allow 3389
Using UFW to allow port 3389 for Remote Desktop Protocol (RDP)
sudo ufw enable
Enabling UFW firewall to protect the system
  • To check rules:
sudo ufw status
Using UFW status command to check active firewall rules

Adjusting Router Settings

  • Access your router’s admin interface and set up port forwarding for port 3389. Use your Ubuntu system’s local IP address as the destination.
  • Test connectivity from outside your local network.

6. Testing the RDP Connection

Local Testing

Find your system’s local IP:

ip addr show
Using the ip addr show command to find the system's IP address
  • Connect using an RDP client (e.g., Microsoft Remote Desktop) with credentials.

Remote Testing

Discover your public IP:

curl ifconfig.me
Using the curl ifconfig.me command to find the public IP address
  • Check if port forwarding is configured. Connect using the public IP.

7. Optimizing RDP Performance

Customizing Session Settings

Edit /etc/xrdp/xrdp.ini to optimize:

bitmap_cache=yes
jpeg_quality=high

Reducing Bandwidth Usage

  • Disable animations and unnecessary visual effects in the desktop environment.
  • Use compression options in your RDP client.

8. Advanced Configurations

Using SSH Tunneling for RDP

  • Securing RDP with fail2ban

Protect against brute-force attacks:

sudo apt install fail2ban -y
Installing Fail2ban to protect against brute-force attacks on RDP
  • Add XRDP rules to /etc/fail2ban/jail.local

Using Certificates for Encrypted Connections

Generate an SSL certificate:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/xrdp/key.pem -out /etc/xrdp/cert.pem

Update /etc/xrdp/xrdp.ini to include certificate paths.

9. FAQs and Troubleshooting

Common Errors and Fixes

  • Black Screen: Make sure the desktop environment is correctly set in 
/etc/xrdp/startwm.sh
Example of how to check the desktop environment setting in XRDP

Best Practices for Secure RDP Use

  • Use strong passwords and limit failed login attempts.

Conclusion

Here is how which gives a good deal of Ubuntu 24.04 to avail RDP to manage their systems with a graphical interface remotely.
Instruction: Enable the Graphical Interface for Remote Desktop Services on the Linux distribution Ubuntu 24.04. According to this guide, you can install, configure, and optimize RDP by using xRDP or other servers like FreeRDP or x2go. With formant access and other basic security features like encryption and fail2ban installed, you can be sure of safe remote access with the least compromise on your system’s performance.


This process ensures that Linux connects with these other platforms, making work productive and easy for the analyst and remote users. Whether for personal use or enterprise purposes, RDP access on Ubuntu is a powerful tool, ensuring a secure, efficient, and user-friendly environment when configured correctly.

About the writer

Vinayak Baranwal Article Author

Vinayak Baranwal wrote this article. Use the provided link to connect with Vinayak on LinkedIn for more insightful content or collaboration opportunities.

Leave a Reply

Your email address will not be published. Required fields are marked *

Lifetime Solutions:

VPS SSD

Lifetime Hosting

Lifetime Dedicated Servers