Install Xrdp on CentOS 8

Installing Xrdp on a CentOS 8 Linux guest in VirtualBox will allow Remote Desktop connections from Windows. These instructions are for CentOS 8 Linux.


Note: This Centos 8 VM is running in VirtualBox. No additional packages or services have been added. It is a bare bones Centos 8 VM with only the following.

  • Minimal Centos 8 installation from .iso.
  • yum group install “Server with GUI”

Ensure Centos 8 VM and Windows are on same Network

If you are running VirtualBox on a Windows host and only have one network adapter, chances are your Windows host will not be able to communicate with your Centos 8 VM.

If you do not have an network interface that is on the same network with an IP address within the same subnet as Windows, follow the instructions below.

  1. In VirtualBox, shutdown the Centos 8 VM
  2. In VirtualBox with the VM selected, select Settings > Network
  3. By default, Adapter 1 may be the only interface running. Select the Adapter 2 tab.
  4. Check the box next to Enable Network Adapter.
  5. Select Bridged Adapter as the option for the Attached to: option. No other options needed, select Ok.
VirtualBox Centos 8 bridged network adapter xrdp
Enable the second network adapter and attached it to Bridged adapter
  1. Start the Centos 8 VM back up
  2. Open a new terminal window and run nmcli. This is where things differ between Centos 7 and Centos 8.
    1. In Centos 7, enp0s8 was connected successfully right away. After adding the bridged adapter in Centos 8, nmcli showed that it was still disconnected.
enp0s8 centos8 bridged adapter disconnected error vbox
Interface enp0s8 is still disconnected after adding the second adapter
  1. Fortunately connecting enp0s8 is simple in Centos 8.
nmcli device connect enp0s8
  1. To verify enp0s8 is now connected, run
nmcli device status
vbox connect enp0s8 interface nmcli device connect centos8
Connect enp0s8 with nmcli, then verify it’s status.

enp0s8 is now connected and should have obtained an IP address from DHCP. Verify the IP address of enp0s8 is on the same subnet as the Windows machine.


Add the EPEL Yum Repository

  1. Xrdp is available in the EPEL repository. The easiest solution is to add the epel-repository so that we may install xrdp via yum install.
  2. Add the EPEL repository to your Centos 8 VM by running
sudo yum install epel-release
epel-release centos 8 install virtualbox vbox repository xrdp
Yum install epel-release Centos 8

With the EPEL repository added, we don’t need to manually download and install xrdp.


Yum Install Xrdp on Centos 8

  1. Install xrdp with Yum or dnf for Centos 8
sudo yum install xrdp
  1. Ensure xrdp starts every time Centos 8 starts:
sudo systemctl enable xrdp.
  1. Start xrdp service on Centos 8
sudo systemctl start xrdp

Xrdp is now installed on Centos 8 and ready to go. However, we must open port 3389 of the firewall to allow connections to the xrdp service.


Open Port 3389 For Xrdp Connections from Remote Desktop

  1. In Centos 8, open port 3389 for xrdp connections with
sudo firewall-cmd --add-port=3389/tcp --permanent.
  1. IMPORTANT: Restart the firewall service.
sudo firewall-cmd --reload
  1. You can verify firewall port 3389 is open by running the following netstat command
[protech@localhost ~]$ sudo netstat -an |grep 3389
tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN     

With verification that firewall port 3389 is open, remote desktop connections from Windows will now be able to communicate with the Xrdp service on Centos 8. Almost done!


Open a Remote Desktop Connection to Centos 8 xrdp

  1. Open Remote Desktop
  2. Enter the IP address of the Bridged Adapter IP (enp0s8) on the Centos 8 VM.
windows remote desktop connection bridged adapter centos 8 vbox virtualbox
Enter the IP address of the enp0s8 interface on the Centos 8 VM
  1. A warning will appear with the message “The identity of the remote computer cannot be verified. Do you want to continue anyway?“.The reason states a name mismatch between the computer’s name (the IP address), and the certificate (XRDP). In addition, the certificate is not trusted. As this is a basic configuration of Xrdp for Centos 7, this is to be expected, and we can accept.
  2. Before selecting yes, check the box next to “Don’t ask me again for connections to this computer“.
vbox certificate error remote desktop centos8 xrdp windows
Check the box to connect despite certificate error
  1. An Xrdp connection windows will appear with with a session type, and username and password fields. Select Xvnc as the Session type, and enter credentials for a Centos 8 account.
  2. IMPORTANT. DIFFERENCE BETWEEN CENTOS 8 vs CENTOS 7. Log out of the Centos 8 VirtualBox session if you want to use the same account for Xrdp. You cannot have two accounts logged in simultaneously via VirtualBox and Xrdp, or Remote desktop. Additional notes below.
vbox virtual box remote desktop connection xrdp centos8 centos session
Use Xvnc as the Session. Enter Centos 8 username and password to start Xrdp session!
  1. A new Remote Desktop window will appear with the desktop for the Centos 8 user, completing the connection to Xrdp.
Centos8 Xrdp connection resolution maximum virtualbox vbox windows connection
Success! Remote Desktop connection to Xrdp on Centos 8.

Notes Centos 7 vs Centos 8 Xrdp

This is another difference between Centos 7 and Centos 8. In Centos 7 the account was still logged in via the VirtualBox windows, and yet the Xrdp connection via Remote Desktop was successful. For Centos 7, this resulted in two concurrent logins with the same account.

However, with Centos 8, using the same login credentials caused the Remote Desktop connection to instantly disappear, without an xrdp black screen, error message, or warning message of any kind.

Logging into Centos 8 via xrdp with another user was successful, even with the original user still logged in via the VirtualBox window. In order to login to Centos 8 via this Xrdp connection with the same user that was used in the VirtualBox window, the user must log out via the VirtualBox window first. Then they will be able to connected via remote desktop to xrdp.

Leave a Reply

Your email address will not be published.