How to connect to CentOS 8 Desktop from Windows using RDP protocol

XRDP is an open-source implementation of the Microsoft Remote Desktop (RDP) that allows you to graphically control your system. With RDP, you can log in to the remote machine the same as you had logged into the local machine. It uses Port 3389 for its connection. In this tutorial, we will look at how to set up the Remote desktop Connection on CentOS 8.

Installing Desktop Environment

I’ll be using a CentOS server for this tutorial which did not has a Desktop environment installed yet. So the first step on my system is to install the Desktop environment. If you have already a GNOME Desktop installed on your CentOS system, then proceed with the next chapter to install XRDP.

To install GNOME on your remote machine, open up the terminal and run the following command:

# dnf groupinstall "Server with GUI"

Install GNOME Desktop

Depending on your system, downloading and install the GNOME packages and dependencies may take some time.

Installing XRDP RDP Server

XRDP is available in the EPEL software repository. If EPEL is not enabled on your system, enable it by typing the following command:

# dnf install epel-release

Now install the XRDP package.

# dnf install xrdp

Install XRDP

Once the installation is complete enable and start the XRDP service.

# systemctl enable xrdp
# systemctl start xrdp

To verify the XRDP is running, type the following command:

# systemctl status xrdp

If the XRDP service is running, the output should be like this as shown in the figure below:

RDP Service is running

You can also verify the XRDP service state by using the following command:

# netstat –atnp | grep 3389

Check RDP port

Port should be Listening like below:

XRDP is listening

Configuring XRDP

The configuration file is /etc/xrdp/xrdp.ini. By default, XRDP uses Linux desktop, which is in our case is GNOME. For the connection, you don’t need to make any changes in the configuration file. This file is divided into different sections and allows you to set global configuration settings such as security and listening address and you can also create different XRDP login sessions.

Open up configuration file /etc/xrdp/xrdp.ini and add the following line at the end of the file.

exec gnome-session

After adding above line restart the XRDP service, using the following command:

# systemctl restart xrdp

Configuring the Firewall

If your firewall is running on your Centos 8, just add the rule to allow the XRDP port/service to allow traffic for the XRDP connection.

# firewall-cmd --add-port = 3389/tcp -- permanent
# firewall-cmd –reload

Connecting to the XRDP using Windows Machine

Windows, by default, uses the remote desktop client. To connect through Centos 8 using remote desktop type Remote desktop connection in the windows search bar and press enter.

Enter the IP address of the remote machine and click on connect.

Remote Desktop connection

It will prompt you to the login screen for the credentials. Enter username and password and click on Ok.

XRDP Login

Once logged in, you should see the default GNOME Desktop. Now you can start interacting with the remote machine.

If you are using Mac OS, install the Microsoft Remote Desktop application from Mac App Store, whereas the Linux user can use RDP clients like Remmina or Vinagre.

Conclusion

In this tutorial, we have learned how to configure Remote desktop Connection in CentOS 8 and access using a windows machine. Using XRDP, allows you to manage and control your machine remotely from your local desktop machine with the use of a graphical interface.