How to Set Up Remote Desktop on Ubuntu (Xrdp)

Andrei Maksimov

Andrei Maksimov

0
(0)

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.

Installing Gnome

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
1. How to Set Up Remote Desktop on Ubuntu - apt-get update

Run the command given below to install Gnome desktop environment:

sudo apt-get install ubuntu-desktop -y
2. How to Set Up Remote Desktop on Ubuntu - apt-get install ubuntu-desktop

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.

Installing Xrdp

Run the following command to install Xrdp:

sudo apt install xrdp -y
3. How to Set Up Remote Desktop on Ubuntu - apt-get install xrdp

After you have installed Xrdp, check the service status by typing the command:

sudo systemctl status xrdp
4. How to Set Up Remote Desktop on Ubuntu - systemctl status xrdp

It shows Xrdp service is up and running. 

Configuring Xrdp

The /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
5. How to Set Up Remote Desktop on Ubuntu - adduser xrdp ssl-sert

Now, restart the Xrdp service:

sudo systemctl restart xrdp
6. How to Set Up Remote Desktop on Ubuntu - systemctl restart xrdp

Using Xrdp

In this section we’ll cover the basic use cases for Xrdp.

Firewall configuration

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
7. How to Set Up Remote Desktop on Ubuntu - ufw allow ssh and rdp

After that, enable and restart ufw:

sudo ufw enable
sudo ufw reload
8. How to Set Up Remote Desktop on Ubuntu - ufw enable and reload

Check the status, if it allowed or not to the server by typing the command shown below:

sudo ufw status
9. How to Set Up Remote Desktop on Ubuntu - ufw status

Connecting to Xdrp server

Now, you can connect to your server using any RDP client software.

MacOS

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.

9. How to Set Up Remote Desktop on Ubuntu - Mac - Add RDP host

Connect to the server to get an amazing experience:

11. How to Set Up Remote Desktop on Ubuntu - Mac - RDP experience

Windows

In the Window’s search box, type “Remote Desktop Connection“.

After entering your remote system’s IP address, click ‘Connect‘: 

12. How to Set Up Remote Desktop on Ubuntu - Windows - RDP client

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“.

13. How to Set Up Remote Desktop on Ubuntu - Windows - RDP authentication

After authentication, you’ll get the same experience.

14. How to Set Up Remote Desktop on Ubuntu - Windows - RDP 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 /etc/xrdp/startwm.sh script:

sudo nano /etc/xrdp/startwm.sh

Here are changes:

unset DBUS_SESSION_ADDRESS
unset XDG_RUNTIME_DIR
15. How to Set Up Remote Desktop on Ubuntu - Fix black screen issue

Restart Xrdp:

sudo systemctl restart xrdp

Reconnect to your server and start using Ubuntu Gnome desktop as expected:

11. How to Set Up Remote Desktop on Ubuntu - Mac - RDP experience

Summary

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.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Subscribe to our updates

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Want to be an author of another post?

We’re looking for skilled technical authors for our blog!

Leave a comment

If you’d like to ask a question about the code or piece of configuration, feel free to use https://codeshare.io/ or a similar tool as Facebook comments are breaking code formatting.