How to Setup RDP on Ubuntu 20 or higher for Remote Access

Publish : 2025 Jan 30 22 view Cat : AVANETCO + Linux
RDP (Remote Desktop) Ubuntu
5/5 - (3 votes)

Set up Remote Desktop Protocol (RDP) on your Ubuntu 20,22,24 server to access a graphical desktop environment from anywhere. This guide will take you through each step to install and configure a desktop environment and XRDP server, enabling smooth remote access to your Ubuntu setup.

 

Whether you’re managing a remote server or working on a virtual machine (VM), a graphical interface can make tasks more intuitive. With RDP access, you can connect to an Ubuntu server’s desktop environment from your local computer. In this article, we’ll guide you through setting up RDP access to an Ubuntu 20,22,24 server, covering desktop environment installation, XRDP setup, and connection configuration.

Pre-requisites Setup RDP on Ubuntu

A remote Ubuntu 20.x or 22.x or 24.x server or VM
A valid IP address for remote access
Basic knowledge of Linux commands
A configured SSH client to access the server initially

High-level Steps To set up RDP access

Update your server to ensure all packages are up-to-date.
Install a desktop environment (GNOME, KDE Plasma, or Xfce).
Install and configure XRDP to enable RDP support.
Adjust firewall settings to allow RDP traffic.
Connect to your Ubuntu desktop using an RDP client.

Why XRDP?

XRDP is an open-source RDP server that provides compatibility with Microsoft’s RDP protocol. It’s lightweight, easy to install, and works seamlessly with Ubuntu. XRDP also allows users to switch between different desktop environments if multiple are installed on the server.

Step-by-Step Guide to Enable RDP Access

Follow these detailed steps to set up RDP access on your Ubuntu 24.04 server.

1. Update Your System

Start by updating your system’s package lists and upgrading any outdated packages. This ensures a smooth installation of the desktop environment and XRDP , Login into SSH and enter the following command .

sudo apt update && sudo apt upgrade -y

2. Install a Desktop Environment

GNOME (recommended):

sudo apt install ubuntu-gnome-desktop -y

3. Install and Configure XRDP

XRDP allows remote connections via the RDP protocol, making it simple to access your server’s desktop environment.

Install XRDP:

sudo apt install xrdp -y

Add XRDP User to ssl-cert Group: This is necessary for secure connections.

sudo adduser xrdp ssl-cert

4. Configure the Firewall

Ensure that your server’s firewall allows traffic on port 3389, which XRDP uses.

sudo ufw allow 3389/tcp
sudo ufw reload

This will enable RDP traffic to reach your server. Always remember to keep your firewall secure by only allowing necessary ports.

6. Create a New User for RDP Access

To securely access your server via RDP, it’s recommended to create a dedicated user. Here, we’ll create a user named avanetco with a password for RDP access. Note: SSH login using a password will not work for this user, as password login is disabled via SSH.

6.1. Create the New User with a Home Directory and Bash Shell:

Use the following command to create the avanetco user with a home directory and set /bin/bash as the default shell:

sudo useradd -m avanetco –shell /bin/bash

6.2. Set a Password for the New User:

sudo passwd avanetco

6.3. Grant Sudo Access to the New User (Optional):

sudo usermod -aG sudo avanetco

Access Ubuntu Desktop via Microsoft RDP

Once your setup is complete, follow these steps to connect to your Ubuntu desktop from a Windows machine:

Open the Microsoft Remote Desktop Client (Remote Desktop Connection on Windows).
Enter your Server’s IP Address: Type the IP address of your Ubuntu server and select “Connect.”
Log in with Your Username and Password: Enter your Ubuntu credentials when prompted.
Select Desktop Environment (if applicable): If you have multiple desktop environments installed, XRDP lets you choose one during the session.