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.
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
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.
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.
Follow these detailed steps to set up RDP access on your Ubuntu 24.04 server.
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
GNOME (recommended): sudo apt install ubuntu-gnome-desktop -y
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
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.
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.
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
sudo passwd avanetco
sudo usermod -aG sudo avanetco
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.