HOW TO REMOTE DESKTOP FROM WINDOWS TO CENTOS SERVER

Published: August 7, 2023 (Updated: Aug 7, 2023)

Enjoying this content? Subscribe to the Channel!

The Ultimate Guide to Remote Desktop (RDP) from Windows to CentOS 9 (It’s Easier Than You Think!)


Welcome back to Darren’s Tech Tutorials! If you’ve ever managed a CentOS server, you know how powerful the command line is. But sometimes, you just need a graphical interface to make things easier, especially when accessing the desktop environment from your Windows machine.

The great news is that getting Remote Desktop Protocol (RDP) running on CentOS 9 is a straightforward process thanks to the XRDP service. This guide walks you through the exact steps needed to install, enable, and secure XRDP so you can connect seamlessly from Windows. While we focus on CentOS 9, these instructions will generally work for other modern Red Hat-based distributions as well!

Let’s dive in and get your remote desktop working!

Prerequisite Check

Before starting, ensure you have SSH access to your CentOS 9 machine and that you are logged in as a user with sudo privileges.

The XRDP package is not included in the default CentOS repositories, so we will be relying on the Extra Packages for Enterprise Linux (EPEL) repository. Fortunately, we can enable it directly during our installation command, which simplifies the process greatly.

Step 1: Install the XRDP Service

XRDP is the open-source server component that enables RDP compatibility on Linux. We will use the dnf package manager and explicitly enable the EPEL repository to fetch the necessary files.

Run the following command on your CentOS 9 server:

sudo dnf --enablerepo=epel -y install xrdp

What this command does:

  • sudo dnf: Executes the command with superuser privileges using the default CentOS package manager.
  • --enablerepo=epel: Temporarily enables the EPEL repository for this specific installation.
  • -y install xrdp: Automatically confirms the installation of the XRDP package.

Step 2: Enable and Start the XRDP Service

Installing the package isn’t enough; we need to tell the system to start the service immediately and ensure it restarts automatically every time the server boots up.

Use the systemctl command to manage the service:

sudo systemctl enable xrdp --now

Verification: To ensure the service is running correctly, you can check its status:

sudo systemctl status xrdp

You should see output indicating the service is active and running (Active: active (running)).

Step 3: Configure the Firewalld Rules

Security is paramount! By default, the CentOS firewall (firewalld) will block incoming connections on RDP port 3389. If you skip this step, your Windows machine will not be able to connect, even if XRDP is running.

We need to add a permanent rule allowing TCP traffic on port 3389.

3a. Add the Port Rule

Execute the command to allow RDP connections:

sudo firewall-cmd --add-port=3389/tcp

Note: This command applies the rule to the current runtime session, meaning it is active immediately.

3b. Make the Rule Permanent

If you were to reboot your server right now, the firewall rule added above would disappear! To prevent this, you must permanently save the configuration:

sudo firewall-cmd --runtime-to-permanent

Once this command completes, your CentOS server is fully configured to accept RDP connections from the outside world.

Step 4: Connecting from Your Windows PC

The hard work on the server is done. Now, switch over to your Windows desktop and use the standard built-in Remote Desktop Connection (RDC) client.

  1. Press the Windows Key and type “Remote Desktop Connection” (or just mstsc).
  2. In the RDC application, enter the IP address or hostname of your CentOS 9 server.
  3. Click Connect.
  4. You will be prompted for your credentials. Enter the username and password of a local user on your CentOS 9 machine.
  5. If successful, the CentOS desktop environment will appear!

Wrapping Up

Congratulations! You’ve successfully bridged the gap between your Windows desktop and your robust CentOS 9 server. Remote access via RDP makes management tasks much more intuitive, especially when dealing with GUI applications.

This XRDP setup is fast, reliable, and gives you the graphical control you need without sacrificing the stability of your Linux server.

Did this tutorial save you some time? Let me know in the comments below! If you found this guide helpful, please Like this post and Subscribe to Darren’s Tech Tutorials for more clear, practical guides on Linux, networking, and server management. Happy computing!