Xrdp is a free and open-source alternative to the Microsoft RDP server that allows non-Windows operating systems. It delivers an entirely operational RDP-well-matched remote desktop experience. RDP will enable you to log into a remote machine and create actual desktop sessions in the same way you would on a local device.
Xrdp integrates parts of the RDP and X Windows systems to transmit the visuals and controls between client and system.
This article will cover how to set up a remote desktop experience using Xrdp on Ubuntu Linux.
Install a Desktop Environment
In this part we’ll install the Gnome desktop environment if you do not have it installed for any reason.
In the Ubuntu Software Center, you may choose between a range of desktop environments. Gnome is the default environment for the recent Ubuntu versions. But if you’d like to install a desktop environment, this part of the article is exactly for you.
Before installing the Gnome, update your APT cache:
sudo apt-get update
Run the command given below to install Gnome desktop environment:
sudo apt-get install ubuntu-desktop -y
The GUI package may take some time to download and install, depending on your system and internet connection. Therefore, before moving on to the following steps, give the installation process some time to complete.
Run the following command to install Xrdp:
sudo apt install xrdp -y
After you have installed Xrdp, check the service status by typing the command:
sudo systemctl status xrdp
It shows Xrdp service is up and running.
/etc/ssl/private/ directory contains a file called
ssl-cert-snoil.key that is the core of the Xrdp service.
You need to add the
xrdp system user to the
ssl-cert system group to allow the service using this file.
Run the following command to accomplish this:
sudo adduser xrdp ssl-cert
Now, restart the Xrdp service:
sudo systemctl restart xrdp
In this section we’ll cover the basic use cases for Xrdp.
The Xrdp listens for user interfaces on port 3389, and you need to enable this port if you are going to use ufw.
Use the following commands are to allow access to the SSH and Xrdp server’s ports from any source network (0.0.0.0/0):
sudo ufw allow from 0.0.0.0/0 to any port 22 sudo ufw allow from 0.0.0.0/0 to any port 3389
After that, enable and restart ufw:
sudo ufw enable sudo ufw reload
Check the status, if it allowed or not to the server by typing the command shown below:
sudo ufw status
Connecting to Xdrp server
Now, you can connect to your server using any RDP client software.
For Mac users, I’d recommend to move forward with Microsoft Remote Desktop for Mac.
Open the application, click Add PC button and fill the PC name with your server hostname or IP address.
Connect to the server to get an amazing experience:
In the Window’s search box, type “Remote Desktop Connection“.
After entering your remote system’s IP address, click ‘Connect‘:
Ignore the certificate issues in the window that asks you to confirm your remote system’s identification.
Click “Yes” to continue with the connection.
Give your credentials on the Xrdp login page and click “OK“.
After authentication, you’ll get the same experience.
Fixing the Black screen issue
During connection to the Xrdp server, you might get a black screen windows rather than an expected GUI experience.
To fix this issue, ssh to your server, and make the following changes to the
sudo nano /etc/xrdp/startwm.sh
Here are changes:
unset DBUS_SESSION_ADDRESS unset XDG_RUNTIME_DIR
sudo systemctl restart xrdp
Reconnect to your server and start using Ubuntu Gnome desktop as expected:
Xrdp is a free and open-source alternative to Microsoft Remote Desktop Protocol that allows you to use a graphical interface to access your Ubuntu server from your local device. This post focuses on installing the Gnome Desktop environment, and Xrdp server to allow you to use the Remote Desktop client.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?