[*]

In this tutorial, we will install xRDP on a server running Ubuntu 20.04 and install some desktop environments (Openbox, GNOME, XFCE, LXQt, LXDE, MATE, KDE Plasma). We will see how to connect via RDP from Windows, Linux, MacOS, Android, and iOS, how to optimize connection speed in some cases, and how to solve some common problems when using xRDP.

xRDP is Microsoft’s free, open source implementation of Remote Desktop Protocol (RDP) that enables non-Windows operating systems to provide full remote desktop functionality.

xRDP is fully compatible with Microsoft RDP, rdesktop, FreeRDP and NeutrinoRDP.

With xRDP, you can have your own RDP server on a Linux box and connect to it via the Microsoft Remote Desktop client (if you’re using Windows), but you can also use Linux, macOS, Android and iOS via their respective clients.

Condition

  • Linux box with Ubuntu 20.04.
  • Office environment.
  • Users with sudo rights. We recommend that you do not run the sudo user, because acting as root can damage your system if you are not careful. When you log in as root, applications run with root privileges and can damage your system due to a bug or vulnerability. You can do whatever you want and the system will not ask you to do it, and you can easily change the system to be harmful if you are not careful. When you use sudo as a non-root user, the system asks you for a password, which can force you to stop and prevent potentially dangerous changes.

Step 1 – Install xRDP on Ubuntu 20.04

Let’s start by updating the package index :

sudo apt update

To install xRDP, run the command:

sudo apt -y install xrdp

The result would look like this:

Read the package lists… Completed
Build Dependency Tree
Read the status… Done
The following packages were installed automatically and are no longer needed:
libunity-gtk2-parser0 libunity-gtk3-parser0 unity-gtk-module-common
Use apt autoremove to remove them.
The following additional packages are installed:
xorgxrdp
Recommended packages:
guacamole xrdp-pulseaudio-installation
The following NEW packages are installed:
xorgxrdp xrdp
0 updated, 2 reinstalled, 0 to remove and 147 not updated.
We need 488 kB of archives.
After this process, 3212 kB of additional hard drive space was taken up.

After installation, it should automatically function as a service. You can check this by entering:

status sudo systemctl xrdp

You should see something like this:

xrdp.service – xrdp daemon
Loaded: loaded (/lib/system/xrdp.service; enabled; vendor preset: enabled)
Active: active (running) from Wednesday 2020-12-23 15:10:48 CET; 3min 24s ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Main PID: 1937 (xrdp)
Tasks : 1 (Limit: 1068)
Memory : 1.4M
CGroup: /system.slice/xrdp.service
└─1937 /usr/sbin/xrdp

xRDP uses the file /etc/ssl/private/ssl-cert-snakeoil.key, which belongs to the ssl-cert group. So we need to add the xRDP user to this group:

sudo adduser xrdp ssl-cert

We need to restart the xRDP for the changes to take effect:

sudo systemctl restart xrdp

At this point, you have xRDP installed and are using it on your Ubuntu.

Opening ports

If you have installed and activated the simple firewall (ufw), we need to open port 3389 (default) of our firewall to connect to our server.

To do this, we need to run:

license sudo ufw 3389

You can make it more secure by only allowing a specific IP address or a range of IP addresses:

For a specific IP address :

sudo ufwfw allow from 1.1.1.1 to any port 3389

For a specific IP range :

sudo ufw permission from 192.168.0.0/24 to any port 3389

xRDP configuration

By default, you don’t need to change anything. However, you can change the default port, add compression and other options by typing:

sudonano /etc/xrdp/xrdp.ini

Remember to restart the service after each change.

Step 2 – Define the preferred office environment

To connect to your computer with xRDP, you must install at least one desktop environment on the computer.

Installing the GNOME desktop environment

GNOME is the default desktop environment for many Linux distributions. At the time of this writing, the latest version is GNOME 3.

To install it, run the following command:

sudo apt -install ubuntu-desktop

This is how the GNOME desktop looks when you log in:
How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Installing the XFCE desktop environment

XFCE is a different desktop environment, but with low system resource consumption and high speed. In other words, a light office. You can set it up by typing:

sudo apt -install xubuntu-desktop xubuntu-core

This is what XFCE looks like:
How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Installing the LXQtdesktop environment

LXQt is a port of LXDE. Like LXDE, it requires fewer resources than most common office environments. In my opinion, this is one of the best uses of xRDP.

To set the operation :

sudo apt -y install lxqt

This is what the LXQt looks like:
How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Installing the LXDE desktop environment

LXDE (Lightweight X11 Desktop Environment) is a popular lightweight desktop environment. It is designed with low resource consumption in mind and is another good choice for xRDP.

There are several ways to install it. For this lesson I will use a simple command. If you want to use different methods depending on your preferences, you can consult the Contexts section on LXDE.org.

For a quick installation of the LXDE startup:

sudo apt -y install lxde

This is what the LXDE looks like:
How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Installing the MATE desktop environment

MATE is an attractive and intuitive office environment. A plugin for the GNOME 2 desktop, in response to the negative reaction of GNOME 3 when using the traditional taskbar (GNOMEx panel) with GNOMEShell.

To set the operation :

sudo apt – install ubuntu-mate-desktop ubuntu-mate-core

This is what the MATE desktop looks like:
How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Installing the KDEPlasma Office Environment

KDE Plasma is one of the most popular desktop environments. In my opinion it is one of the nicest office environments, it has very good functionality and is very customizable.

You can install it by running:

sudo apt – install kubuntu-desktop

This is what KDE Plasma looks like:
How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Installing the Openbox Window Manager

Openbox is a window manager, not a desktop environment. You have no access to a wallpaper, taskbar or control panel. But it’s very light, and you can open the menu by right-clicking anywhere on the screen and selecting what you want to run.

This is probably the best choice if you find that your connection is behind xRDP, but you need to connect to a Linux machine running xRDP.

This is what the Openbox looks like:
How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Switching from one desktop environment to another for xRDP

If you have more than one desktop environment installed and want to switch between them, you can run the following command:

sudo update-alternatives – configure x-session-manager

The options for the desktop environments you installed are displayed. Enter the number that corresponds to your office environment in the list and press the Enter key.

There are 9 variants of the alternative x-session manager (provided by /usr/bin/x-session manager).

Path selection priority Status
————————————————————
0 /usr/bin/startlxde 50 Automatic mode
1 /usr/bin/gnome-session 50 Manual mode
2 /usr/bin/lxsession 49 Manual mode
3 /usr/bin/mate-session 50 Manual
4 /usr/bin/open-box-session 40 Manual
* 5 /usr/bin/startlxde 50 Manual
6 /usr/bin/startlxqt 50 Manual
7 /usr/bin/startplasma-x11 40 Manual
8 /usr/bin/startxfce4 50 Manual
9 /usr/bin/xfce4-session 40

Click to save the current selection [*], or enter the selection number: 2
update-alternatives : Use of /usr/bin/lxsession to provide /usr/bin/x-session-manager (x-session-manager) in manual mode.

In my example, I have nine options:

0 – /usr/bin/startlxde – current desktop environment
1 – /usr/bin/gnome-session – GNOME 3
2 – /usr/bin/lxsession – LXDE
3 – /usr/bin/mate-session – MATE Desktop
4 – /usr/bin/openbox-session – Openbox
5 – /usr/bin/startlxde – LXDE (as lxsession)
6 – /usr/bin/startlxqt – LXQt
7 – /usr/bin/startplasma-x11 – KDE Plasma
8 – /usr/bin/startxfce4 – XFCE
9 – /usr/bin/xfce4-session – XFCE (as startxfce4)

I think the correct way to start LXDE is startlxde, and the correct way to start XFCE is to choose startxfce4. I still don’t know why lxsession and startlxde both appear, since they both select one of the two switches on LXDE. The same goes for startxfce4 and xfce4-session – selecting one of these options will switch to XFCE. As far as I know, startlxde and startxfce4 are scripts that call the binaries lxsession and startlxde respectively. If you know of an explanation for this, please let us know and we will update the guide.

The next time you connect to the server via xRDP, the desktop environment will need to be adjusted. It is not necessary to restart xRDP to make changes.

Interacting with xRDP service

Like any other service, you can communicate with xRDP via systemctl :

Stop the xRDP service:

sudo systemctl stop xrdp

Start the xRDP service:

sudo systemctl start xrdp

Enable xRDP at startup:

sudo systemctl enable xrdp

Disable xRDP at startup :

sudo systemctl disable xrdp

Step 3 – Connecting to a Remote Office

To connect to our new RDP service, you must use an RDP client.

Window connection

The Microsoft RDP client is called Remote Desktop Connection by default and is installed by default.

For a quick connection, enter the IP address or hostname of the Ubuntu machine and click Connect.

Clicking View Options displays other options, such as entering a user name, saving data for later use so you don’t have to re-enter it each time, configuring the connection quality settings, etc.

How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Connecting to Linux

There are many options for using the RDP client on Linux, but Remmina is an interesting option with many features. I also use it in my daily life.

If you haven’t installed it yet, you can install it with the following command.

sudo apt -y remmina* install

How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

When you open Remmina, you can quickly log in (1) or connect and save (2).

Quick coupling

For a quick connection, as in the image above, select RDP from the drop-down list and simply type the IP address or hostname of the server into the field on the right and press Enter. You will then be asked to enter your login details.

Stored connection

To create a registered connection, click the + icon in the top left corner, the remote desktop settings screen will appear. There are several options you can customize. For the purposes of this lesson, we will only mention a few:

The name is the name of the friendly connection. This does not affect the connection and is only for your convenience Server
– Server IP address or host name
Username – Your user name
Password – Your password
Color depth – The setting can help with slow connections. If the connection is delayed, try setting it to High Color (15 bpp). The lowest is 256 colors (8 bpp), but it’s annoying.
Advanced -> Quality Settings – allows you to configure the quality of the connection. This is important if you find that your connection is slow/slow. If the connection is delayed, set it to Faulty (fastest) if it is not already set.

Connecting to macOS

To connect to an RDP session in macOS, we first need to install the Microsoft Remote Desktop application from the App Store.

After installation, simply enter the IP address or hostname of your server and click Connect.

How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Android/iOS

On Android, we need to download and install the Microsoft Remote Desktop application from PlayStore.

On iOS, it’s the same procedure, but we have to download it from the AppStore.

After downloading and installing it, launch it and you will see a toolbar. Yours is probably empty, mine has a port I already saved.

Click on the + symbol and you will get a form where you can enter the server information.

How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

At a minimum, you must enter the host name or IP address and click Save. You will then see a saved session, as shown in the first screenshot, which you can click to log into. A window will appear to connect to your server, where you can enter your login and get started.

Frequent travel

Problem with blank screen

When you log in, a blank screen sometimes appears.

There is a known bug in the xRDP program, but it is easy to fix.

When you’re done with your RDP session, don’t close the window first! Log out of the system instead.

If you log out instead of closing the window, the problem of a blank screen does not arise.

However, if for some reason you forget to log out, you will have to delete all users:

sudo pkill -u username

You can then log in again without seeing a blank screen.

xRDP delay

In addition to the fixes listed below, a universal method of speeding up xRDP connections may be to use a lower resolution.

Remote desktop delay/delay when connecting to Windows

  1. Connecting to Remote Desktop Display and Experience
    If the connection is slow when connecting from Windows, you can reduce the Display -> Color Settings and Experience -> Performance Settings, which will reduce the visual quality of the experience, but hopefully increase the speed.
    How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP
  2. Set the priority in real time in Task Manager
    You can also set the highest priority, i.e., in real time, in Task Manager. Just open Task Manager and right click on Remote Desktop Connection in the Process window and zoom in. The Details tab appears with mstsc.exe selected. Right-click and select Set Priority -> Live from the context menu.
    How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP

Delay of the remote desktop when connecting from Linux (with Remmina)

  1. Remmina allows you to adjust the color depth and the quality of the connection. When making a connection, you can change the color depth in the main tab. I recommend the high color (15 bpp) because I think it also provides good visibility. In the Advanced tab, you can also change the quality to Poor (fastest) – but the default is probably set this way.
    How to Connect to a Ubuntu 20.04 Server via Remote Desktop Connection using xRDP
  2. I’m not sure, but I think it might be helpful if you also set the priority of the Remmina process to the highest level in the System Monitor. Again, I’m not sure to what extent this can improve performance.

Authentication required to create a Color Managed Device

You will probably get several pop-ups with the title Authentication is required to create a color management device. Depending on the desktop environment, these pop-up windows may appear 2 to 4 times.

You can just fire them and get on with your job. They probably won’t bother you during the current session.

For a detailed explanation of why this happens and how to fix it, see this xRDP article – Known Authentication Required to Create a Managed Color Device, explained at c-nergy.co.uk.

We will summarize their statements and find a solution to avoid this in the future.

Explanation: Ubuntu uses the PolKit software component, which is the basis for application authorization. It records the actions performed by the user and verifies that the user is authorized to perform these actions on the system. PolKit reads certain policy files that indicate whether a user is authorized, unauthorized, or requires authorization to perform an action.

Solution: Here’s a quick fix for this problem.

Create the file 02-allow-colord.conf in /etc/polkit-1/localauthority.conf.d. To do this, run the following command:

sudo nano /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf

Now paste the following content, replacing the users with the group your user belongs to:

polkit.addRule(function(action, subject) {
if ((action.id == org.freedesktop.color-manager.cree-device |
action.id == org.freedesktop.color-manager.cree-profile |
action.id == org.freedesktop.color-manager.delete-device |
action.id == org.freedesktop.color-manager.delete-profile ||
action.id == org.freedesktop.color-manager.modify-device ||
action.id == org.freedesktop.color-manager.modify-profile) &&
subject.isInGroup({users}) {
return polkit.result.YES;
}
}) ;

Now the file essentially tells PolKit that if a user belongs to a user group (or a group you use instead of users), they can create the device, change the profile and color without asking for authentication.

Results

Bravo! We hope you were able to install and configure xRDP on your Ubuntu 20.04 machine and install the desktop environment of your choice.

If you have any problems, please contact us and we will try to help you as soon as possible.

Resources and gratitude

Authentication required to create a color-controlled device adapted from :

xRDP – The Infamous “Authentication Required to Create Managed Color Device” Explained

The slowness of the remote desktop when connecting from Windows is adjusted from :
https://stackoverflow.com/questions/37276637/rdp-session-is-slow

Reasons why it’s bad to always connect as a root, adapted from
https://askubuntu.com/questions/16178/why-is-it-bad-to-log-in-as-root

Custom script to install optimized xRDP, plus some interesting patches and detailed instructions:
https://c-nergy.be/blog/?tag=xrdp

 remote desktop ubuntu 20.04 to windowsubuntu 20.04 screen sharing missingubuntu 20.04 vncunable to locate package xrdpxrdp disconnects after loginuninstall xrdpubuntu xrdp black screenubuntu 18.04 remote desktop from windowsubuntu 16.04 remote desktop from windowsubuntu remote desktop to windowsrdp to ubuntu 20.04 slowaskubuntu can i access ubuntu from windowsremote desktop from ubuntu to windowsinstall xrdp centos 7polkitubuntu remote desktopx2go1.First, we need to provide our Ubuntu server system with a desktop environment. Let’s install Gnome in this example.2.To install xRDP package, run:3.You also need to grant access to the /etc/ssl/private/ssl-cert-snakeoil.key file for xrdp user. It is available to members of the ssl-cert group by default.1.First, we need to provide our Ubuntu server system with a desktop environment. Let’s install Gnome in this example.2.To install xRDP package, run:3.You also need to grant access to the /etc/ssl/private/ssl-cert-snakeoil.key file for xrdp user. It is available to members of the ssl-cert group by default.ubuntu 20.04 xrdp blank screenubuntu 20.04 xrdp xfcehow to activate rdp in ubuntu serverremote gui for ubuntu serverheadless xrdpubuntu 19.04 xrdp not workingxrdp exits immediately after connectingxrdp kdeubuntu 20.04 remote desktop from macubuntu xrdp exitsubuntu 20.04 remote desktop from windows black screenubuntu 20.04 remote desktop black screenubuntu 20.04 remote desktop access from windows 10ubuntu 20.04 remote desktop clientxrdp ubuntu 20.04 black screen

You May Also Like

Android – android.os.NetworkOnMainThreadException –

Development issue/problem: I have this exception, and I read a thread about…

Android Gradle CompilationFailedException after Android Studio Update –

Development issue/problem: I get the following mistake when making my project: org.gradle.api.internal.tasks.compile.CompilationFailedException…

How to Enable and Configure User Disk Quotas in Windows?

Disk quotas allow Windows administrators to control and limit the space users…

How to reset an iPad? – Best Tablets For Best Prices

21. December 2020 Ernest Is your iPad suddenly lethargic and unusually slow?…