Total Pageviews

Tuesday, June 8, 2021

Accessing Linux Desktop/Server from Windows remotely: using RDP and xRDP

The graphical Remote Desktop Connection is one of the most common methods of working on a Remote Windows based Server or Desktop for Windows users. All Microsoft Windows editions have built-in support for RDP on Windows OS. Doing RDP from a Windows to a Linux environment is easy but requires a few configurations on the remote Linux Server/Desktop.

XRDP: It is a popular Linux open source development that brings several Windows-like features, such as the following:

  • Two-way clipboard transfer (text, bitmap, file)
  • Audio redirection
  • Drive redirection (mount local client drives on remote machine)
  • RDP transport is encrypted using TLS by default

The following configuration steps can be used on all RPM based Linux distributions, such as Red Hat, Fedora, CentOS, and Oracle Linux. For this tutorial, we will be using “Rocky Linux 8.4 RC1 (https://rockylinux.org) - An alternative Linux to CentOS”. Please note that this distribution is not ready for production use yet, but the method described here is applicable to all other Linux.

Step-by-step guide:

Suppose the hostname of the Linux Server is “RockyLinux01 – 192.168.0.15”. We want to RDP to this server from a Window 10 Desktop.

  • Login as root on the Linux Server/Desktop.
  • If the GNOME Desktop Environment has not been installed already, install the GNOME Package using the following command:

   dnf groupinstall 'Server with GUI'

Installing GNOME package

  • Enable the EPEL repository for XRDP package:

   dnf install epel-release

  • Install the XRDP package:

   dnf install xrdp

  • Enable and start the XRDP service:

   systemctl enable xrdp

   systemctl start xrdp
  • Add the exec gnome-session to the /etc/xrdp/xrdp.ini. You can open the xrdp.ini file using vi, nano or any other text editor. I use nano:

   nano /etc/xrdp/xrdp.ini

Editing xrdp.ini

  • Add a firewall rule to allow the RDP port 3389 to pass through:

   firewall-cmd --add-port=3389/tcp --permanent

   firewall-cmd --reload
  • Restart the XRDP service:

   systemctl restart xrdp

  • Check if everything is running as expected:

    systemctl status xrdp

    netstat –atnp | grep 3389
 
xrdp service status on Linux
  • Open the Windows Remote Desktop Connection app and log on to the server. Following are some screenshots using XRDP.

 Screenshots:

Microsoft RDP

xrdp login window on Linux
Using Microsft RDP to login to a Linux

 References: