Installing Xrdp on a CentOS 8 Linux guest in VirtualBox will allow Remote Desktop connections from Windows. These instructions are for CentOS 8 Linux.
- Install Xrdp on CentOS 7 Linux: Install Xrdp on CentOS 7.
- Install Xrdp on Ubuntu 20 Linux: Remote Desktop from Windows to Ubuntu Xrdp.
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”
Table of Contents
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.
- In VirtualBox, shutdown the Centos 8 VM
- In VirtualBox with the VM selected, select Settings > Network
- By default, Adapter 1 may be the only interface running. Select the Adapter 2 tab.
- Check the box next to Enable Network Adapter.
- Select Bridged Adapter as the option for the Attached to: option. No other options needed, select Ok.
- Start the Centos 8 VM back up
- Open a new terminal window and run
nmcli
. This is where things differ between Centos 7 and Centos 8.- In Centos 7, enp0s8 was connected successfully right away. After adding the bridged adapter in Centos 8,
nmcli
showed that it was still disconnected.
- In Centos 7, enp0s8 was connected successfully right away. After adding the bridged adapter in Centos 8,
- Fortunately connecting enp0s8 is simple in Centos 8.
nmcli device connect enp0s8
- To verify enp0s8 is now connected, run
nmcli device 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
- 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
. - Add the EPEL repository to your Centos 8 VM by running
sudo yum install epel-release
With the EPEL repository added, we don’t need to manually download and install xrdp.
Yum Install Xrdp on Centos 8
- Install xrdp with Yum or dnf for Centos 8
sudo yum install xrdp
- Ensure xrdp starts every time Centos 8 starts:
sudo systemctl enable xrdp.
- 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
- In Centos 8, open port 3389 for xrdp connections with
sudo firewall-cmd --add-port=3389/tcp --permanent.
- IMPORTANT: Restart the firewall service.
sudo firewall-cmd --reload
- 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
- Open Remote Desktop
- Enter the IP address of the Bridged Adapter IP (enp0s8) on the Centos 8 VM.
- 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.
- Before selecting yes, check the box next to “Don’t ask me again for connections to this computer“.
- 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.
- 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.
- A new Remote Desktop window will appear with the desktop for the Centos 8 user, completing the connection to Xrdp.
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.