Install XRDP on CentOS

Install XRDP on CentOS

If you are looking for something similar to remote desktop for CentOS, you are in luck, XRDP is the answer. Let’s get started.

XRDP is an open-source RDP server. It accepts connections from the Windows Remote Desktop client (mstsc), rdesktop or FreeRDP on port 3389 and starts a graphical Linux session for the user. It has two services: xrdp handles the RDP connection, and xrdp-sesman (the session manager) authenticates the user through PAM and starts their desktop, by default inside an Xvnc server.

Prerequisites

This package requires the EPEL Repository, if you have not yet, please install this on your CentOS Server/Desktop

  • A desktop environment installed on the server (for example the “Desktop” and “X Window System” groups), otherwise there is nothing to show after login.
  • A VNC server for the default sesman-Xvnc module (yum install tigervnc-server if the xrdp package did not pull it in).
  • TCP 3389 reachable from your client.

1) Install XRDP

Issue the magical command to install xrdp

yum -y install xrdp.x86_64 from the EPEL repository
yum -y install xrdp.x86_64

2) Start the services

once installed, start the service, and configur it to run after a reboot

chkconfig xrdp on and service xrdp start, Starting xrdp and xrdp-sesman OK
chkconfig xrdp on
service xrdp start

The init script starts both xrdp and xrdp-sesman. Open the firewall too:

iptables -I INPUT -p tcp --dport 3389 -j ACCEPT
service iptables save

3) Review xrdp.ini

the main configuration file for XRDP is /etc/xrdp/xrdp.ini

vi /etc/xrdp/xrdp.ini

the main thing is to make sure the crypt-level is set to high

xrdp.ini [globals] with port=3389 and crypt_level=high

In the [globals] section, port=3389 is the listening port and crypt_level=high uses the strongest RDP-native encryption. The sections below [globals] define the modules offered in the login dialog (sesman-Xvnc and others). Restart xrdp after changing the file.

4) Connect

that’s it, now launch either a Linux rdesktop connection to the host, or a remote desktop session, now you should be able to login with your LDAP or local login credentials

Login to xrdp dialog with module sesman-Xvnc and username andrew

From Windows run mstsc and enter the server’s IP; from Linux, rdesktop 192.168.1.20 or xfreerdp /v:192.168.1.20. Choose the sesman-Xvnc module and log in. LDAP accounts work because sesman authenticates through PAM, the same as a console login.

Verify

service xrdp status
netstat -tlnp | grep -E '3389|3350'

xrdp listens on 3389 and sesman on its default port 3350.

Troubleshooting

  • Cannot connect at all: firewall, or the service is not running.
  • Login dialog appears but login fails or the connection log ends with an error: read /var/log/xrdp-sesman.log and /var/log/xrdp.log. A missing Xvnc binary (no tigervnc-server) is a classic cause.
  • Black or grey screen after login: no desktop environment installed, or the same user is already logged in on the console with a session that conflicts. Log out locally or try another user.
  • Keyboard layout wrong: the keymap is negotiated from the client; set the right layout in the client or in the desktop session.

RHEL, AlmaLinux and Rocky 9/10

xrdp is still packaged in EPEL:

dnf install epel-release        # AlmaLinux/Rocky; on RHEL enable EPEL per the Fedora docs
dnf install xrdp
systemctl enable --now xrdp
firewall-cmd --permanent --add-port=3389/tcp
firewall-cmd --reload

Current xrdp versions negotiate TLS with the client (settings security_layer, certificate and key_file in xrdp.ini) and offer an Xorg backend through the separate xorgxrdp package in addition to Xvnc. If logins fail with SELinux enforcing, check ausearch -m avc -ts recent before turning anything off.

That’s it!

Hosted Linux Servers at www.zwiegnet.com/go

Related guides: Configure CentOS XDMCP Logins | Install Xnest CentOS 6

Leave a Reply

Your email address will not be published. Required fields are marked *