Linux

How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04

How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04

Xrdp is an open source implementation of Microsoft Remote Desktop Protocol (RDP) that allows you to control remote systems graphically. With RDP, you can log in to a remote machine and make a real desktop session the same as if you were logged into a local machine.

This tutorial covers how to install and configure an Xrdp server on Ubuntu 20.04.

Install the Desktop Environment

The Ubuntu server is managed from the command line and does not have a desktop environment installed by default. If you are running the desktop version of Ubuntu, skip this step.

There are various desktop environments available on the Ubuntu repository that you can choose from. One option is to install Gnome, which is the default desktop environment on Ubuntu 20.04. Another option is to install Xfce. This is a fast, stable and lightweight desktop environment, which makes it ideal for use on remote servers.

Run one of the commands below to install the desktop environment of your choice.

  • Install Gnome:

sudo apt update
sudo apt install ubuntu-desktop

  • Install Xfce:

sudo apt update
sudo apt install xubuntu-desktop

Depending on your system, downloading and installing a GUI package will take time.

Install Xrdp

Xrdp is included in the default Ubuntu repository. To install it, run:

sudo apt install xrdp 

After the installation is complete, the Xrdp service will automatically start. You can verify it by typing:

sudo systemctl status xrdp

The output will look like this:

Output :

xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2020-05-22 17:36:16 UTC; 4min 41s ago

By default Xrdp uses the /etc/ssl/private/ssl-cert-snakeoil.key file that can only be read by members of the “ssl-cert” group. Run the following command to add xrdp users to the group:

sudo adduser xrdp ssl-cert  

Restart the Xrdp service for the changes to take effect:

sudo systemctl restart xrdp

There she is. Xrdp is installed on your Ubuntu server, and you can start using it.

Xrdp Configuration

The Xrdp configuration file is located in the / etc / xrdp directory. For basic Xrdp connections, you don’t need to make any changes to the configuration file.

Xrdp uses the default X Window desktop environment (Gnome or XFCE).

The main configuration file is named xrdp.ini. This file is divided into sections and allows you to set global configuration settings such as security and listen to the address and create a different xrdp login session.

Every time you make changes to the configuration file, you need to restart the Xrdp service.

Xrdp uses the file startwm.sh to launch session X. If you want to use another X Window desktop, edit this file.

Configure the Firewall

The Xrdp daemon listens on port 3389 on all interfaces. If you run a firewall on your Ubuntu server, you must open the Xrdp port.

To allow access to the Xrdp server from a specific IP address or IP range, for example, 192.168.33.0/24, you will run the following command:

sudo ufw allow from 192.168.33.0/24 to any port 3389

If you want to allow access from anywhere (which is not recommended for security reasons), run:

sudo ufw allow 3389

To increase security, you can consider setting up Xrdp to only listen on localhost and create an SSH tunnel that forwards traffic safely from your local machine on port 3389 to a server on the same port.

Connecting to Xrdp Server

Now that you have set up your Xrdp server, it is time to open your Xrdp client and connect to the server.

If you have a Windows PC, you can use the default RDP client. Type “remote” in the Windows search bar and click “Remote Desktop Connection”. This will open the RDP client. In the “Computer” field, enter the remote server’s IP address and click “Connect”.

1

On the login screen, enter your username and password and click “OK”.

2

After logging in, you will see the default Gnome or Xfce desktop. It should look like this:

3

You can now start interacting with the remote desktop from your local machine using your keyboard and mouse.

If you are running macOS, you can install the Microsoft Remote Desktop application from the Mac App Store. Linux users can use RDP clients such as Remmina or Vinagre.

Conclusion

Configuring remote desktop allows you to manage Ubuntu 20.04 servers from your local machine through an easy-to-use graphical interface.

If you have questions, feel free to leave a comment below.

Related posts

How to Install Apache ActiveMQ on Debian 10

Linux

How to get started with Kali Linux in 2020

Linux

How to Install VirtualBox Guest Additions on Ubuntu 20.04

Linux

How to Install Django on Ubuntu 20.04 LTS

Linux

How to Install CouchDB on Ubuntu 20.04

Linux

How to make a POST request with cURL

Linux

How to Install the Open Source Computer Vision Library (OpenCV) on CentOS 8

Linux

How to Install and Use a Linux Firewall

Linux

How to Change the Directory Name in Linux

Linux