Hosting Mate

Just another UBER CLOUD site

  • Home

How to Install Xrdp on Ubuntu 20.04

Contributor on January 22, 2021

Xrdp is an open-source equivalent of Microsoft’s Remote Desktop Protocol (RDP). With xrdp installed on a Linux system, users can remotely access the Linux desktop using an RDP client as we shall demonstrate later in this article. It’s completely free to download and use.

Without much further ado, let’s see how you can install Xrdp on Ubuntu Desktop 20.04 and 18.04.

Prerequisites

This guide assumes that you already have a copy of the Ubuntu 20.04 or Ubuntu 18.04 desktop already installed. If you have a minimal installation – without a GUI – then installing a desktop environment (such as GNOME) is recommended.

To install the Ubuntu desktop environment, run the command:

$ sudo apt install ubuntu-desktop

Step 1: Install Xrdp on Ubuntu 20.04

To start off, launch your terminal and invoke the following command to install Xrdp on your system.

$ sudo apt install xrdp

When prompted, just hit 'Y' and press enter to continue with the installation.

Install Xrdp on Ubuntu
Install Xrdp on Ubuntu

Xrdp service starts automatically upon installation. You can verify this by running the command:

$ sudo systemctl status xrdp
Verify Xrdp Status on Ubuntu
Verify Xrdp Status on Ubuntu

The output confirms, without a doubt, that the xrdp daemon is active and running.

Step 2: Configure Xrdp on Ubuntu 20.04

When Xrdp is installed, an SSL certificate key – ssl-cert-snakeoil.key – is placed in the /etc/ssl/private/ folder. We need to add the xrdp user to the ssl-cert group to make the file readable to the user.

$ sudo adduser xrdp ssl-cert
Add Xrdp User to SSL Cert Group
Add Xrdp User to SSL Cert Group

Xrdp listens on port 3389 and if you are behind a UFW firewall, you need to open the port to allow inbound traffic from an RDP client. In this example, I will allow traffic from my entire subnet to the Ubuntu system.

$ sudo ufw allow from 192.168.2.0/24 to any port 3389

Thereafter, reload the firewall and confirm if the port has been opened.

$ sudo ufw reload
$ sudo ufw status
Open Xrdp Port on Ubuntu Firewall
Open Xrdp Port on Ubuntu Firewall

Step 3: Access Remote Ubuntu Desktop with RDP Client

In this step, we are going to access the Ubuntu desktop system from Windows 10 using the Remote Desktop Client. But before we do so, ensure that you first log out of Ubuntu 20.04. This because Xrdp only supports one Xsession.

Next, launch your client and key in your remote system’s IP address, and click the ‘Connect’ button.

Connect Remote Ubuntu System with RDP
Connect Remote Ubuntu System with RDP

On the pop-up that requires you to verify the identity of your remote system, ignore the certificate errors and click on the ‘Next’ button to proceed with the connection.

Verify Identity of Remote Ubuntu System
Verify Identity of Remote Ubuntu System

On the Xrdp login page, provide your login credentials and click ‘Ok’.

Enter Ubuntu Login
Enter Ubuntu Login

NOTE: At this point, you might encounter a blank black screen, instead of an Ubuntu desktop background. In fact, I personally encountered it and after some digging, I discovered a nifty workaround.

Fix Black Ubuntu Screen

The solution is quite simple. Head over to the remote system and edit the /etc/xrdp/startwm.sh script.

$ sudo vim /etc/xrdp/startwm.sh

Add these lines just before the lines that test & execute Xsession as shown in the screenshot below.

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
Fix Ubuntu Black Screen
Fix Ubuntu Black Screen

Save the file and exit. Then restart the Xrdp service.

$ sudo systemctl restart xrdp

Next, reinitiate the connection. After the initial authentication, you will be required to authenticate again as shown.

Ubuntu Login
Ubuntu Login

Provide your credentials and click ‘Authenticate’ and finally, this ushers you to the desktop screen of the remote Ubuntu desktop system as shown.

Remote Ubuntu Desktop Sharing
Remote Ubuntu Desktop Sharing

We’d love to hear your feedback and, more specifically, the challenges that you encountered. We hope that this guide was useful.

Related posts:

  1. How to Install SQLite and SQLite Browser in Ubuntu
  2. How to Install Apache Nifi in Ubuntu Linux
  3. How to Install Latest Mate Desktop in Ubuntu and Fedora
  4. How To Prevent PHP-FPM From Consuming Too Much RAM in Linux
  • Category: Web Hosting
  • Tag: Linux Desktop Sharing, Remote Linux Desktop Tools, Ubuntu, Ubuntu Tips
  • Post navigation

    Previous: Previous post: How to replay terminal sessions recorded with the Linux script command
    Next: Next post: How to change the identity of a Linux system

Posted by Contributor

All Posts

Recent Posts

  • Add listening ports to firewalld with Ansible
  • Best RDP (Remote Desktop) Clients for Linux
  • 5 ways Red Hat Insights can improve your sysadmin life
  • How to work with lists and dictionaries in Ansible
  • 3 surprising things you can do with the Linux wc command

RSS WiredGorilla

  • Scammer use this simple trick – don’t get caught!
  • The World Runs On Linux (NOT Windows!)
  • Performance improvements in WordPress 6.1
  • Snaps & better refresh notifications
  • Learn about MLOps: Kubeflow at OSXP 2022