LFCS - Remote Desktop Protocol

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
344
Reaction score
387
Credits
11,920
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:

Code:
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.

Code:
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:

Code:
sudo apt install xrdp xorgxrdp-hwe-18.04 -y

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

Code:
sudo ufw allow 3389/tcp

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

Code:
sudo systemctl start xrdp
sudo systemctl enable xrdp

To make sure, we need to enable the firewall:

Code:
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:

Code:
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes

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

Code:
[Allow Package Management all Users]
Identity=unix-user:*
Action=org.freedesktop.packagekit.system-sources-refresh
ResultAny=yes
ResultInactive=yes
ResultActive=yes

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:

Code:
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:

Code:
sudo systemctl restart xrdp

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

Conclusion

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


Top