[stordis-toc]
Introduction
Remote Desktop Protocol (RDP) lets you use the desktop of an Ubuntu machine from another computer. On Windows, you use the built-in Remote Desktop Connection client. You do not need to install other software.
This guide shows how to set up the RDP server xrdp on Ubuntu 24.04 with the light XFCE desktop.
Prerequisites
- Ubuntu 24.04 (Desktop or Server).
- A user account with sudo rights.
- Network access to the machine on TCP port 3389.
What you need
- The IP address of the Ubuntu machine.
- The name of the user for the remote desktop. In this guide:
stordis. - The network of the computers that will connect, for example
192.168.1.0/24.
Pro Tip
Ubuntu 24.04 Desktop has a built-in RDP server for the GNOME desktop: Settings > System > Remote Desktop. Use it if you only need to share the local desktop. Use xrdp (this guide) for a server without a monitor or for separate sessions of different users.
RDP setup script generator
Select your settings. The generator makes the commands of Steps 1–5 in the correct order. The generator operates only in your browser.
The script generator needs JavaScript. Use the commands in Steps 1–5.
Step 1: Update the system
sudo apt update && sudo apt upgrade -y
Step 2: Install xrdp and the XFCE desktop
- Install xrdp. On Ubuntu Server, also install XFCE:
sudo apt install -y xrdp xfce4
- Give the
xrdpservice access to the TLS certificate:
sudo adduser xrdp ssl-cert
- Start xrdp and start it automatically after a reboot:
sudo systemctl enable --now xrdp
Step 3: Prepare the user for RDP
- Create the user (skip this if the user exists). Replace
stordiswith your user name:
sudo useradd -m -s /bin/bash stordis sudo passwd stordis
- Optional: give the user sudo rights:
sudo usermod -aG sudo stordis
- Set XFCE as the desktop session of this user. Each RDP user needs this file:
echo "xfce4-session" | sudo tee /home/stordis/.xsession sudo chown stordis: /home/stordis/.xsession sudo systemctl restart xrdp
Step 4: Allow RDP through the firewall
Allow RDP only from the network of your computers. Replace 192.168.1.0/24 with your network:
sudo ufw allow from 192.168.1.0/24 to any port 3389 proto tcp sudo ufw reload sudo ufw status
To allow RDP from all networks, use sudo ufw allow 3389/tcp in place of the first command.
CAUTION
Do not make port 3389 available on the internet. For access from outside your network, use a VPN. Before you enable ufw on a remote machine (sudo ufw enable), allow SSH: sudo ufw allow OpenSSH.
Step 5: Connect from Windows or Linux
-
Make sure that xrdp listens on port 3389:
sudo ss -tlnp | grep 3389
- On Windows, open Remote Desktop Connection (
mstsc). On Linux, use an RDP client, for example Remmina. - Type the IP address of the Ubuntu machine and click Connect.
- Type the user name and the password from Step 3. The XFCE desktop opens.
Troubleshooting
- Make sure that the file
/home/<user>/.xsessionexists and containsxfce4-session(Step 3). - The same user cannot be logged in on the local screen and through RDP at the same time. Log out the user on the local screen.
The xrdp service must be in the ssl-cert group:
sudo adduser xrdp ssl-cert sudo systemctl restart xrdp
- Make sure that xrdp listens on port 3389 (Step 5).
- Make sure that the ufw rule includes the network of your computer (
sudo ufw status). - Show the logs:
sudo journalctl -u xrdp -u xrdp-sesman -n 50 --no-pager
Procedure completion
Congratulations!
You have successfully set up RDP on Ubuntu 24.04. Now you can use the Ubuntu desktop from your Windows or Linux computer.
Happy networking!
Useful links:
How to Set Up noVNC on Ubuntu 24.04 for Remote Access via Web Browser?
How to install NTP server in Ubuntu 24.04
For more free resources, visit: https://stordis.com/free-resources/
Comments 0
Comments
Please sign in to leave a comment.