×


Configure XRDP to Securely Connect Remote Linux Servers - Step by step process ?


Configure XRDP to Securely Connect Remote Linux Servers - Step by step process ?

RDP is an Open Source Remote Desktop Protocol that works as an alternative to Windows RDP to connect to remote Linux servers with GUI. XRDP supports VNC (Virtual Network Compute) protocol that uses RFB ( Remote Buffer Protocol) to control remote systems. 

XRDP is a way easy to use in place of other tools because of no additional package required for this. 

In order to make it more secure, we will show you making its secure connection through SSH Tunneling.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform rdp related queries.

In this context, we shall look into how to install and use xrdp on a Linux OS.


How to configure XRDP to Securely Connect Remote Linux Servers ?

The prerequisites in this article are to have a remote Linux server with GUI (Graphical User Interface) environment, running xrdp, and a local X windows system to connect to the remote server.

To begin, follow the steps given below.


1. Install XRDP

In order to install xrdp, let's connect to your remote Linux server using ssh and run the system updates that you can do by the following commands.

For RHEL/CentOS:

# yum update -y 

For Debian/Ubuntu:

# apt-get update -y

Once your system has the latest update installed, you can install the xrdp by the use of the below command.

For RHEL/CentOS:

# yum install xrdp -y

For Debian/Ubuntu:

$ sudo apt-get install xrdp

Press "Y" to continue the installation along with its required dependencies.


2. Start XRDP Service

After the installation of xrdp we need to make sure that its service is running and enabled for the auto-restart at the time of reboot.

Use the below commands to check its running start and enable auto restart:

$ sudo systemctl status xrdp
$ sudo systemctl enable xrdp

The same commands can be used in case you are using a RHEL base Operating System.


3. Secure XRDP Connections

Here, securing the xrdp connections is most important to restrict unauthorized access to your remote systems. 

To make it secure we are going to make some changes in its configuration file.

i. Let's open the xrdp.ini using your favorite file editor as below:

$ sudo vim /etc/xrdp/xrdp.ini
port=tcp://.:3389

ii. Save the changes and restart xrdp service:

$ sudo systemctl restart xrdp

Now you will see the state of port '3389' listening for the localhost IP.


4. Create Secure SSH Tunnel

To make a secure tunnel between the remote and local system we are going to make use of Windows Powershell.

Run the command below followed by the IP address of your remote Linux Server with GUI as below:

PS C:\Users\kashif\> ssh user@xx.xx.xx.xx -L 3399:127.0.0.1:3389

Once your ssh connection is established after giving the credentials of your user name, you are ready to connect to the Remote Linux Server through RDP.


5. Connect to Remote Linux Server

After making the local session, now we are ready to connect to the remote Linux server, whether it's a CentOS/RHEL or Ubuntu with GUI support.

i. Open the Remote Desktop Connection App of your source Windows system and connect using the localhost and source port '3399' from your previous connection:

Localhost:3399

ii. Give the same username and password that you have used while making the local ssh tunnel between your localhost and remote server IP.

After providing the right credentials, you will have a successful remote RDP session established.


6. How to improve XRDP Session Performance ?

While using the XRDP sessions, you might have come to know that its performance is slower than the traditional RDP sessions on Windows OS. 

To overcome this problem you can make some tweaks in the RDP settings.

i. Open the RDP App, go to its Display Tab and change the color depth of the remote session to a lower value. 

ii. Next, move to the Experience Tab and choose the connection speed with optimal performance as 56kbps.

iii. Next, open your Task Manager and set the priority of mstcsc.exe to Realtime.


[Need assistance in setting up RDP on Linux OS? We are available to help you. ]


Conclusion

This article covers how to install and use XRDP to securely connect to remote servers. Xrdp is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to control a remote system graphically. 

With RDP, you can log in to the remote machine and create a real desktop session the same as if you had logged in to a local machine.


Installing Xrdp on Debian:

Xrdp package is available in the standard Debian repositories. To install it, run:

$ sudo apt install xrdp 

The service will automatically start once the installation process is complete. You can verify that the Xrdp service is running by typing:

$ sudo systemctl status xrdp


How to Configure Xrdp on Linux?

The Xrdp configuration files are stored in the /etc/xrdp directory.

Whenever you make any changes to the configuration file you need to restart the Xrdp service:

$ sudo systemctl restart xrdp

Search by typing a one letter Word Term Here