I want to recommend VPS hosting from professionals with the best technical support, on which this website works. They have VPS and dedicated servers for any needs. Sign up and get a 25% discount on the first payment for any SSD VPS when paying for one, three or six months.
Currently, there are many options for remote connection to workspaces. In addition, the cost of renting a good performance VM in the cloud per month is comparable to the price of a good cup of coffee. Such remote virtual machines are convenient to use from weak office computers, from trips with a laptop and a weak Internet connection, to run long-term tasks on them, such as re-checking documents in 1C, downloading large files.
You can also organize a shared server based on Ubuntu 20.04 in the cloud or on a powerful computer and share its resources using remote access. In this article, we will look at how to install XRDP Ubuntu 20.04.
- What is XRDP?
- Step 1. Search for a package
- Step 2. Update the system
- Step 3. Installing Packages
- Step 3. Configuring the XRDP Service
- Step 4. Search for an IP address
- Step 5. Checking the connection
- XRDP black screen error in Ubuntu
What is XRDP?
XRDP is an open source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to graphically manage a remote system.
Unlike a commercial product, XRDP in Linux allows an unlimited number of users to work simultaneously with a single computer or virtual machine, which allows you to actively use XRDP to deploy terminal servers based on Ubuntu 20.04.
Installing XRDP on Ubuntu 20.04
Step 1. Search for a package
In Ubuntu 20.04, you can get the program installed using the apt utility. Let’s install XRDP from the Ubuntu 20.04 repository. To do this, you can use the terminal to check if there is an xrdp package in the Ubuntu 20.04 package store:
sudo apt searh xrdp
Step 2. Update the system
There is such a package, so you can pre-update the system by simply installing xrdp on Ubuntu 20.04. We update and reboot to accept changes to the OS:
sudo apt –y update && sudo apt –y upgrade && sudo reboot
Step 3. Installing Packages
After rebooting, you can install XRDP from the Ubuntu 20.04 repository
sudo apt install xrdp
Please note that the installation generates a certificate that is required for the operation of the RDP protocol, the line below indicates that the certificate was successfully created:
Step 3. Configuring the XRDP Service
Due to the features of the Ubuntu 20.04 system, you must enter the xrdp user on behalf of which XRDP is running in the system into the ssl-cert group. Run the command:
sudo adduser xrdp ssl-cert
Then add the xrdp service to autorun and restart it to apply the changes:
sudo systemct enable xrdp
sudo systemctl restart xrdp
sudo systemctl status xrdp
If the result of the command execution looks like in the screenshot, then everything was successful. In the end, grant access from the external network to port 3389 in the Ubuntu 20.04 firewall:
sudo ufw allow from 192.168.2.0/24 to any port 3389
sudo ufw allow 3389
Step 4. Search for an IP address
Using any RDP client, you can connect by the computer name, perhaps you need to configure DNS additionally. It is better to get access by the IP address of the server where XRDP is installed. To find out the IP address, enter the command in the terminal:
sudo ip a
In my screenshot, the IP address of a virtual machine running Ubuntu 20.04 is circled, which is automatically assigned to the eth1 network interface. There can be several network interfaces, each of them can have its own IP addresses, which can also be connected via RDP.
Step 5. Checking the connection
The standard RDP client for Windows is calledRemote desktop connection. In it, you must enter the IP address or server name, you can specify a username and password to log in to the remote machine, and configure various interaction parameters.
In the screenshot below, you can see the Xorg login window, where you need to enter a username, in my case user, and a password, in my case 1. To change the keyboard layout in Ubuntu 20.04, use the Super + keyboard shortcutSpace bar (with my Windows keyboard keys + Space). If the layout does not change in the window, and the password is entered in the wrong language, then you need to disable the RDP client, close it, change the language in Windows to the desired one, and reconnect to the remote machine.
Ubuntu 20.04 XRDP setup is almost complete.
XRDP black screen error in Ubuntu
To fix this error, you need to make a change to the file located in the /etc/xrdp folderthat starts each XRDP remote access session with the name startwm.sh:
Make changes to the file startwm.sh:
Before the line:
test –x /etc/X11/Xsession && exec /etc/X11/Xsession
as shown in the screenshot. This resets the system variables generated by previous sessions. As a result, we get rid of the black screen when connecting via RDP to Ubuntu 20.04
After making the changes, you must restart the XRDP service:
sudo systemctl restart xrd
And you can connect to Ubuntu via RDP:
Today we found out how to connect to Ubuntu via RDP and configure the XRDP server. RDP clients exist for any device: phone, tablet, laptop, any computer. The location of this virtual or real machine with Ubuntu 20.04 now does not matter, as long as it is accessible via the Internet and XRDP is installed and configured.