How to Check RDP service in Linux offered by XRDP

Remote Desktop Protocol (RDP) is not directly available on Linux systems, hence to enable it on Linux, we use open-source implementations of RDP with the help of solutions like XRDP. However, managing XRDP server remote desktop sessions on Linux can be challenging if you don’t know how to do that. In this article, we learn a few commands to check the RDP services status and active RDP sessions on Linux apart from that managing the XRDP service and checking its log file are also included.

Checking RDP Service status and connections in Linux

1. Check XRDP Service Status

If you already have the XRDP installed on your Linux system then to ensure RDP is running in the background to accept the remote connection, check its service status. For that, we use the given command, which will verify the XRDP service is active and running on your Linux machine:

sudo systemctl status xrdp

The output will be something like the one shown in the given screenshot with an “active (running)” status showing the RDP is available on your Linux system.:

Start and enable XRDP service

However, if you get an output saying the service is not found then that means XRDP is not yet installed on your system. To install it, use the given command:

For Debian, Ubuntu, MX Linux, Linux Mint, and more…

sudo apt install xrdp

For Redhat, Fedora, Alamlinux, Rocky, Oracle Linux, AWS, and more…

sudo dnf install xrdp

2. List Active RDP Sessions

Now, those who already have confirmed the XRDP is installed and actively running on their Linux system but now want to check for active RDP sessions, then use the following command.

sudo netstat -antup | grep xrdp

If any user on your Linux system is actively connected by some remote user using the remote desktop protocol (RDP), then that will be listed in the output. Note that, active RDP sessions typically use port 3389 by default, so look for entries with this port number.

If while using this command you get the error: netstat: command not found then run – sudo apt install net-tools first to install it.

List Active RDP sessions on Linux using command

3. Monitor XRDP Log Files

Many times even though the XRDP is actively running, it still gets errors while logging in to the Linux remotely over RDP connections. Hence to troubleshoot that or any other issue we can take the help of Log files to get the details like session start and end times, errors, and other relevant activities.

sudo cat /var/log/xrdp.log
sudo cat /var/log/xrdp-sesman.log

3. Managing XRDP Service

After installing the XRDP, if it is not started automatically then we need to start it manually, so let’s learn the command to start/stop/restart and enable XRDP Service using a Linux terminal.

  1. Start XRDP:
sudo systemctl start xrdp
  1. Stop XRDP:
sudo systemctl stop xrdp
  1. Restart XRDP:
sudo systemctl restart xrdp
  1. Configure XRDP to Start on Boot

To let the XRDP get started automatically, in case of a service crash or system boot, we need to enable it manually. Here is the command:

sudo systemctl enable xrdp

FAQs

Q1: How can I change the default port for XRDP to enhance security?

The default port used by XRDP is 3389. if someone wants to change it then he/she needs to edit the sudo nano /etc/xrdp/xrdp.ini file. And there under the [Globals] section and modify the port value. To save the file use Ctrl+X, type – Y, and hit the Enter key After making changes, restart the XRDP service for them to take effect.

change XRDP port

Q2: What should I do if XRDP is not accepting connections?

First, check in the firewall, the XRDP port is opened and allowed to accept remote connection. Also, the user of Linux must be logged out from the system that we are going to use to log in remotely using RDP.

To open the default port for XRDP in the firewall Debian or Ubuntu Linux:

sudo ufw allow 3389/tcp

Follow our guide to get a clear idea of how to use XRDP on Debian 12 Linux

Q3: Can I use RDP to connect to a Linux machine from a Windows PC?

Yes, with the help of open-source solutions like XRDP, we can easily access and control remotely Linux systems using RDP clients on Windows 11 or 10 desktops.

Q4: Are there any security concerns with using RDP on Linux?

As with any remote access tool, using RDP can expose your system to risks if not securely configured. Ensure you use strong authentication methods, change the default ports, and consider setting up a VPN for additional security.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.