How to Install Xrdp Remote Desktop on Ubuntu 20.04 Focal Fossa

Introduction

In this article we will learn How to Install Xrdp Remote Desktop on Ubuntu 20.04 Focal Fossa. However, Xrdp Remote Desktop Server is an open source and freely available remote desktop application. Moreover, it uses Microsoft Remote Desktop Protocol that enables us to connect to the remote computer. Additionally, Xrdp Server enables us to logon to the remote computer by initiating a new user session. Furthermore, the user connected to the remote computer feels just as working on a local computer.

How to Install Ubuntu 20.04 Desktop Operating System

In addition to above, according to the official website of Xrdp, it accepts graphical connections from many different RDP clients. Some of the examples of these RDP Clients are FreeRDP, rdesktop, NeutrinoRDP and Microsoft Remote Desktop Client (for Windows, macOS, iOS and Android).

Install Desktop Environment on Ubuntu 20.04

Furthermore, if you are installing Xrdp Remote Desktop Server on Ubuntu 20.04 Server system. Then you have to install a Desktop Environment on your Ubuntu Server System. Because Xrdp Server connects to graphical interface only and Ubuntu Server does not have the graphical interface. However, to install the Desktop Environment on Ubuntu Server, open the terminal window and issue the following command.

Update Ubuntu System

sudo apt update && sudo apt upgrade

However, the above command will update your Ubuntu Server System. Furthermore, after the system is updated. Next install the tasksel utility on Ubuntu 20.04. Now,  issue the following command in the terminal window. Further, the tasksel utility is used to install Desktop Environment in Ubuntu operating system.

sudo apt install tasksel -y

Now run the tasksel utility by issuing the following command in the terminal window.

tasksel

Furthermore, the output of the above command will be similar to the given below image.

Tasksel Desktop Environment Installation Utility

Next, scroll down the list and select the Ubuntu desktop and Ubuntu minimal desktop from the list as shown in the figure. Then click on the OK button at the bottom of the screen. Moreover, the Desktop Environment will take some time to install. Additionally, the installation time will depend on the configuration of your computer system. After the installation of all the packages is complete. We have to set our system to boot into the graphical environment. Furthermore, to do this issue the following command in the terminal window.

systemctl set-default graphical.target

Now restart the Ubuntu System to apply the changes.

However, if you are installing Xrdp Server on Ubuntu Desktop System. Then you do not need to install any Desktop Environment. Moreover, the Ubuntu desktop system already has the default Ubuntu Desktop Environment installed on it.

Installing Xrdp Remote desktop Server on Ubuntu 20.04 Focal Fossa

The Xrdp Remote Desktop Package is a part of standard repository of Ubuntu 20.04 Focal Fossa operating system. Therefore this can be installed with the apt command of Ubuntu 20.04 operating system. Now to install Xrdp Remote Desktop Server, open the terminal window. Then issue the following command as shown below.

sudo apt install xrdp

Furthermore, when you will run the above command the system will prompt you for installation of the application. However, on the affirmative response the installation will begin.

Xrdp Service Status

Additionally, after the completion of the installation of Xrdp remote Desktop Server. The Xrdp service will automatically start running. However, to verify whether the Xrdp service is running or not. Issue the following command in the terminal window as shown below.

sudo systemctl status xrdp

However, the output of the above command will be similar to the figure as shown below.

xrdp.service – xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: >

Active: active (running) since Sat 2021-09-04 10:35:36 IST; 13min ago

Docs: man:xrdp(8)

man:xrdp.ini(5)

Process: 699 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, s>

Process: 707 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/>

Main PID: 720 (xrdp)

Tasks: 1 (limit: 4651)

Memory: 1.4M

CGroup: /system.slice/xrdp.service

└─720 /usr/sbin/xrdp

Sep 04 10:35:35 pentarock xrdp[707]: (707)(140289779410752)[INFO ] address [0.0>

Sep 04 10:35:35 pentarock xrdp[707]: (707)(140289779410752)[INFO ] listening to>

Sep 04 10:35:35 pentarock xrdp[707]: (707)(140289779410752)[INFO ] xrdp_listen_>

Sep 04 10:35:35 pentarock xrdp[707]: (707)(140289779410752)[DEBUG] Closed socke>

Sep 04 10:35:35 pentarock systemd[1]: xrdp.service: Can’t open PID file /run/xr>

Sep 04 10:35:36 pentarock systemd[1]: Started xrdp daemon.

Sep 04 10:35:37 pentarock xrdp[720]: (720)(140289779410752)[INFO ] starting xrd>

Sep 04 10:35:38 pentarock xrdp[720]: (720)(140289779410752)[INFO ] address [0.0>

Sep 04 10:35:38 pentarock xrdp[720]: (720)(140289779410752)[INFO ] listening to>

Sep 04 10:35:38 pentarock xrdp[720]: (720)(140289779410752)[INFO ] xrdp_listen_>

The Xrdp Remote Desktop Server uses the /etc/ssl/private/ssl-cert-snakeoil.key file. This file can only be accessed by the users who are members of the “ssl-cert” group. Now we have to add Xrdp to “ssl-cert” group. To do this open the terminal window and issue the following command to add the xrdp user to this group.

sudo adduser xrdp ssl-cert

Xrdp Blank Screen Issue on Ubuntu 20.04

Sometimes some users face black screen issue when connecting. To avoid this issue open the configuration file of xrdp  “/etc/xrdp/startwm.sh” in a text editor. Issue the following command to open the file in the nano editor.

sudo nano /etc/xrdp/startwm.sh

Now add the lines in the file as shown below in the figure.

Blank Screen Issue

Added Commands in the above file are:

unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR

. $HOME/.profile

Save the file and exit from the nano editor. Now restart the server for new configuration to take effect.

Now the Xrdp Server is properly installed on your computer and you can start using it.

Configuring the Firewall in Ubuntu 20.04 Focal Fossa

The Microsoft RDP port 3389 is the default port of the Xrdp Server. Therefore we have to open this port in the firewall so that connection can be made through this port. Additionally we have the option to open this 3389 port for some specific IP addresses. Otherwise, we can open this port for all IP addresses. It is recommended that you open this port for specific IP Addresses only for security reasons. I assume that you have UFW firewall installed on your Ubuntu 20.04 system. To open a specific IP address for this port issue the following command in the terminal window.

sudo ufw allow from 192.168.1.25/24 to any port 3389

The above command will allow the IP Address 192.168.1.25 through 3389 port.

To allow all the IP Addresses issue the following command in the terminal window.

sudo ufw allow 3389

Allowing all IP addresses id not recommended.

Connecting to Xrdp Server

Now we have installed and configured the Xrdp Server and ready to connect from Windows. Now move to any Windows machine and run the remote desktop command. The output is shown in the figure below.

Microsoft Remote Desktop

Now enter the IP Address of the Ubuntu 20.04 System to connect with Microsoft Remote Desktop Application. Then Click connect button to initiate the connection. The output will be as shown in the figure below.

RDP Login Window

Now enter the user name and password of the remote Ubuntu 20.04 system to log on to the remote system. Click on the OK button to log on to the remote computer. After the system is connected then it will look like the image given below.

How to Install Xrdp Remote Desktop on Ubuntu 20.04 Focal Fossa - Remote Desktop Screen

Now we have successfully installed and configured the Xrdp Server on Ubuntu 20.04 Focal Fossa. Enjoy!

Leave a Reply

Your email address will not be published.