15 Aug 2025
The Remote Desktop Protocol (RDP) is a Microsoft-developed network protocol that enables users to remotely access and control the graphical interface of a Windows server. It operates on a client-server model: an RDP client runs on your local device, while the RDP server runs on the remote machine.
While RDP is primarily used for Windows, you can also connect to the graphical interface of a Linux server using xrdp, an open-source RDP server implementation.
In this guide, you’ll learn how to install and configure xrdp on an Ubuntu 22.04 server to enable Remote Desktop access. We’ll cover setting up a lightweight desktop environment, configuring the firewall, testing connections from Windows, macOS, and Linux, optimizing performance, supporting multiple users, and handling Wayland/Xorg compatibility.
To complete this tutorial, you will need:
sudo
privileges, a firewall, and at least 2GB of RAM, which you can buy on nanohost.org if you don't have one yetBy default, Ubuntu Server provides only a terminal interface. To use a graphical user interface (GUI) over RDP, you’ll need to install a desktop environment.
For this setup, you’ll install Xfce
, a lightweight and user-friendly desktop environment for Linux.
1. Connect to your server via SSH and update the package list:
sudo apt update
2. Install Xfce and additional tools:
sudo apt install xfce4 xfce4-goodies -y
3. During installation, you’ll be asked to choose a display manager (the program that handles graphical logins and sessions).
lightdm
is recommended.gdm3
, but you may choose lightdm
if you prefer.4. Once the desktop environment is installed, you can proceed with installing xrdp to enable Remote Desktop access.
xrdp is an open-source Remote Desktop Protocol (RDP) server for Linux, allowing remote desktop connections from RDP clients on Windows, macOS, or Linux.
1. Install xrdp:
sudo apt install xrdp -y
2. Check the service status:
sudo systemctl status xrdp
If the installation was successful, the status should show active (running).
Output ● xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: **active (running)** since Sun 2022-08-07 13:00:44 UTC; 26s ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Main PID: 17904 (xrdp)
Tasks: 1 (limit: 1131)
Memory: 1016.0K
CGroup: /system.slice/xrdp.service
└─17904 /usr/sbin/xrdp
3. Start the service manually if needed:
sudo systemctl start xrdp
Then verify the status again to ensure it’s running.
With xrdp installed and running, you’re ready to configure it to accept remote connections from clients.
The main xrdp configuration file is located at /etc/xrdp/xrdp.ini. It defines global settings, logging options, channel parameters, and available session types.
1. Edit the configuration file:
sudo nano /etc/xrdp/xrdp.ini
[Xorg]
or [Xvnc]
.By default, the username and password parameters are set to ask, prompting the user for credentials during connection. For initial use, the default configuration is sufficient. Save and close the file.
2. Set the default session manager:
echo "xfce4-session" | tee ~/.xsession
This ensures that xfce4-session is used when logging in over RDP. Without this file, the graphical session will fail to start.
3. Restart xrdp:
sudo systemctl restart xrdp
4. Allow RDP through the firewall:
curl ifconfig.me
sudo ufw allow from your_local_ip/32 to any port 3389
sudo ufw status
Port 3389 is now open for RDP connections from your IP address.
With xrdp installed and configured, you can now test the connection from your local machine.
On Windows
1. Open the Remote Desktop Connection app.
2. In Computer, enter your server’s public IP.
3. In User name, enter your server username (click Show Options if the field is hidden).
4. Click Connect.
If you see a connection error, ensure port 3389 is open in the firewall and xrdp is running.
5. When prompted for identity verification, click Yes.
6. Enter your server username (e.g., sammy
) and password, then click OK.
After successful login, you’ll see your Ubuntu desktop environment.
You can close the RDP session at any time by clicking the Exit button.
Testing the RDP Connection on macOS
To connect from macOS, you will use the Microsoft Remote Desktop application, available for free in the Mac App Store.
1. Install and open the Microsoft Remote Desktop app. You can download it directly from the Mac App Store.
2. Add your remote server:
• Click Add PC.
• In the PC name field, enter your server’s public IP address.
3. Configure the user account (optional):
• Under User account, you can add your username and password now, so you won’t have to enter them every time you connect.
• If you skip this step, the app will prompt you for your credentials when you connect.
4. Start the connection:
• Select the newly created connection and click Start (or double-click it).
• If an identity verification popup appears, click Yes to continue.
5. Log in to your Ubuntu server:
• If prompted, enter your Ubuntu username (e.g., sammy
) and password.
• Click OK to proceed.
6. Access the desktop. After a few seconds, you should see your Ubuntu desktop environment via RDP.
When finished, you can close the session by clicking the Exit button in the Microsoft Remote Desktop app.
Testing the RDP Connection on Linux
To connect from Linux, you will need an RDP client. In this example, you’ll use Remmina, a free and open-source remote desktop client.
1. Install Remmina (on Ubuntu or Debian-based systems):
sudo apt install remmina
y
to confirm.2. Launch the application
3. Set up the connection:
4. Log in:
sammy
) and password.Xorg
).5. Unlock the desktop (if prompted). You may need to enter your password again to unlock the remote desktop.
6. Access the Ubuntu desktop. After logging in, your remote Ubuntu desktop environment will appear.
When finished, close the RDP session using the Exit button.
Once you’ve verified that the connection works, you can repeat this process any time you need graphical access to your remote server.
1. Can I use xrdp to connect from Windows to Ubuntu?
Yes. Once xrdp is installed and configured on your Ubuntu server, you can connect from Windows using the built-in Remote Desktop Connection app. Simply enter the server’s public IP address in the Computer field to start an RDP session.
2. What port does xrdp use?
By default, xrdp listens on TCP port 3389, the standard RDP port. Ensure this port is open in your firewall and accessible from the client machine.
3. Why do I get a black screen after logging in via RDP?
A black screen usually points to a misconfigured session. Common causes include:
~/.xsession
file.Xorg
)..xsession
setup often resolves the issue.4. Is xrdp secure for remote access?
RDP includes built-in encryption, but you should add extra layers of security:
5. How do I change the desktop environment for xrdp?
Update your ~/.xsession
file to start a different desktop environment. For example, to use LXDE:
echo "startlxde" > ~/.xsession
Make sure the environment is installed and restart the xrdp service:
sudo systemctl restart xrdp
6. Do I need to open any firewall ports for xrdp?
Yes. Open TCP port 3389 for RDP connections. To allow only your IP:
sudo ufw allow from {your_ip_address}/32 to any port 3389
Replace {your_ip_address}
with your public IP.
7. Can multiple users connect to the same server with xrdp?
Yes. Each user needs their own Linux account and .xsession
file. xrdp provides isolated sessions for each user, and limits can be adjusted in /etc/xrdp/sesman.ini
.
8. How do I fix authentication errors in xrdp?
Possible causes include:
.xsession
file..xsession
is set correctly, and permissions are proper:chmod 755 ~/
chown : ~/.xsession
Whether you’re applying kernel updates, clearing a stuck device, or finishing a configuration change, a reboot is sometimes the cleanest fix. This guide shows beginner-friendly and safe ways to restart Linux immediately (“reboot now Linux”), plus how to force reboot if the system is unresponsive. We’ll cover desktops, servers, and remote machines over SSH.
Learning how to move around and manage files and folders in the Linux filesystem is one of the most important skills for working with any computer. On cloud servers, these tasks are usually done through the terminal using well-known Linux shells and standard commands. This guide will walk you through some of the essential skills needed to work with files and directories from the terminal.
Learn the basics of the Linux terminal — what it is, how the shell and command prompt work, and how to run your first commands.