LFCS - Remote Desktop Protocol

Jarret B

Well-Known Member
Staff member
May 22, 2017
Reaction score
If you have ever run Windows, especially at an extensive business, you may have seen the operations of the Remote Desktop Protocol (RDP). The protocol allows a machine to take over a remote machine. This can allow techs to control another system to troubleshoot errors that are not hardware issues.

Hopefully, you can see where this can be a very useful tool, but not only in large business settings. You may also see where this is especially useful, if you are a tech in a large company that may have multiple sites.

With this protocol, you can connect to a system and get access to the Graphical User Interface (GUI) instead of the Command-Line Interface, like in Secure Shell (SSH).

To make this work, we need to install RDP for the X Server, or XRDP, on our Linux system. I must say that this was simple on CentOS, but required some working to get it to function on Ubuntu 18.04. We will cover each distro on its own.

Install RDP on CentOS 7

Check that your system is up to date by performing an 'update'.

You need to make sure you have the repository for 'epel-release'. From the repository, you can download the packages with the command:

sudo yum install xrdp -y

When you install the 'xrdp' package, it includes the 'tigervnc' dependencies.

The service, after installation, is stopped and disabled, so we need to change this.

sudo systemctl enable xrdp
sudo systemctl start xrdp

The running service should now start on each boot.

Install RDP on Ubuntu 18.04

Make sure your system is up to date with an update and upgrade.

Next, install 'xrdp' and other packages with the command:

sudo apt install xrdp xorgxrdp-hwe-18.04 -y

Once you perform the installation, you need to open the needed port on the firewall:

sudo ufw allow 3389/tcp

The service needs to be started and enabled to start on reboot:

sudo systemctl start xrdp
sudo systemctl enable xrdp

To make sure, we need to enable the firewall:

sudo ufw enable

Next, we need to change the system policies to so we aren't kicked out of the RDP connection once it opens. There are two files that need to be created in the folder '/etc/etc/polkit-1/localauthority/50-local.d/'. The first file is '45-allow-colord.pkla' and should contain the following lines:

[Allow Colord all Users]

The second file is '46-allow-update-repo.pkla' and contains:

[Allow Package Management all Users]

Once all of this is complete, reboot the system.

Connect to RDP

The purpose is to connect from Windows, but we need to connect from a Linux system as well. So, let's look how we can get this to work.

We will start with Windows first. Run the command 'mstsc.exe'. If you cannot find the program, then go to the Microsoft Store in Windows and find the Microsoft Terminal Services Client, or Remote Desktop Connection and install it.

Once loaded, start the app and type in the IP Address to the CentOS or Ubuntu Server in the 'Computer' entry. Click on 'Connect' and then type in your Username and Password for the CentOS Server.

NOTE: This will also work to connect to a VirtualBox connection if it is a Bridged Connection.

If the app tries to use the Windows Hostname in the Username, such as 'HP-Mini\jarret', just change it to only the username. If it includes the Windows Hostname, it should send the password for the Windows system, which may not match on the Linux system.

From a Linux system, you can use Remmina. Use on if the following commands, depending on your Operating System:

sudo yum install remmina -y
sudo apt install remmina -y

Remmina may ask to set up certificates, so if asked, answer 'Yes'.

Once started, type in the IP Address of the Linux Server. Click the button to add a new connection profile. Give your connection a name. Under Protocol, select 'RDP - Remote Desktop Protocol'. Enter your Username and Password.

NOTE: With either Windows or Linux, you cannot log in using the same username as a currently logged in user to the remote system. Create a new account and use it.

If you have problems logging in as a specific user, make sure the user is not already logged in locally to the remote system. Also, have the remote system logged in as a completely different user if anything doesn't work.

For Ubuntu, I lost track of the number of times I had to reinstall Ubuntu and try different things to get this to work.

Startup Commands

When using the Remote Desktop Protocol, you can have commands or scripts executed whenever the remote user connects.

You can make changes locally on the RDP system, or you can SSH into the remote system and perform them through a Command-Line Interface (CLI).

When the remote user logs into the system remotely, there is a script that is run at '/etc/xrdp/startwm.sh'. Carefully change this file to set up commands and scripts you need executed when the remote user is connected. Be aware, if you make any changes, then restart the 'xrdp' service with:

sudo systemctl restart xrdp

Be sure to test changes to verify that they work as required.


Being able to remote into a system with a Graphical User Interface (GUI), can be very helpful when trying to fix an issue. Also, this works well for systems that are headless (no monitor).

Make sure you have worked with this Virtualization function and that you can get it to work.
Last edited:

I also find it to be a very smooth program!

I don't know if it's on topic, but I have a few other reccomendations, and would love to discuss the future of video streaming and remote computer control.
I don't know if it's on topic, but I have a few other reccomendations, and would love to discuss the future of video streaming and remote computer control.

You should just start your own thread on the matter to talk about those things. This is a tutorial thread, after all.

Members online