How to Deploy and Configure xrdp on Linux: A Complete Guide

If you’re looking for a way to remotely access your Linux desktop environment, deploying and configuring xrdp is an excellent solution. xrdp is an open-source Remote Desktop Protocol (RDP) server that allows you to connect to a Linux system using the standard RDP client. This guide will walk you through the steps to deploy and configure xrdp on Linux system, ensuring a smooth remote desktop experience.

xrdp on Linux


What is xrdp?

xrdp is an open-source implementation of the Microsoft RDP server, allowing users to connect to a Linux desktop environment from a Windows or Linux client. It provides a graphical login to remote machines, making it easier to manage and operate your Linux server from anywhere.


Benefits of Using xrdp

  • Cross-Platform Compatibility: Works seamlessly with Windows Remote Desktop clients.
  • User-Friendly: Simplifies the process of accessing a Linux desktop remotely.
  • Open Source: Free to use and continuously developed by the community.

How to Deploy and Configure xrdp on Linux

Step 1: Update Your System

Before you begin the installation, it’s essential to update your system’s package index. Open a terminal and run the following commands:

For Debian/Ubuntu:

sudo apt update && sudo apt upgrade -y

For CentOS/RHEL:

sudo yum update -y

Step 2: Install xrdp

Next, you need to install the xrdp package. Use the following commands based on your Linux distribution:

For Debian/Ubuntu:

sudo apt install xrdp -y

For CentOS/RHEL:

sudo yum install epel-release -y
sudo yum install xrdp -y

Step 3: Start and Enable the xrdp Service

Once xrdp is installed, you need to start the xrdp service and enable it to start at boot:

sudo systemctl start xrdp
sudo systemctl enable xrdp

Step 4: Configure the Firewall

To allow RDP connections, you need to configure your firewall. For systems using UFW (Ubuntu):

sudo ufw allow 3389/tcp

For firewalld (CentOS/RHEL):

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

Step 5: Install a Desktop Environment (if needed)

If your server does not have a graphical desktop environment, you will need to install one. Here are some options:

For Ubuntu (Installing Xfce):

sudo apt install xfce4 -y

For CentOS (Installing Xfce):

sudo yum groupinstall "Xfce" -y

Step 6: Configure xrdp to Use the Desktop Environment

You need to specify which desktop environment xrdp should use. Open the xrdp startup configuration file:

echo "xfce4-session" > ~/.xsession

Make sure to replace xfce4-session with the appropriate session if you are using a different desktop environment (e.g., gnome-session for GNOME).

Step 7: Connect to Your Linux System

Now that you have configured xrdp, you can connect to your Linux machine using any RDP client. Here’s how to do it on a Windows machine:

  1. Open the Remote Desktop Connection application.
  2. Enter the IP address of your Linux machine.
  3. Click “Connect.”
  4. Enter your Linux username and password when prompted.

FAQs

What is the default port for xrdp?

The default port for xrdp is 3389. Make sure this port is open in your firewall settings.

Can I use xrdp with other desktop environments?

Yes, xrdp supports various desktop environments, including GNOME, KDE, and LXDE. Just ensure you configure it correctly in the ~/.xsession file.

How can I troubleshoot connection issues?

If you’re experiencing connection issues, check the following:

  • Ensure the xrdp service is running: sudo systemctl status xrdp
  • Verify your firewall settings.
  • Check the xrdp logs located in /var/log/xrdp.log for any error messages.

Is xrdp secure for remote connections?

While xrdp itself is not encrypted, you can secure your connection by tunneling through SSH. This can be done by using an SSH client that supports port forwarding.

What are alternatives to xrdp?

Other remote desktop solutions include VNC (Virtual Network Computing) and NoMachine. These may offer different features and performance levels depending on your needs.


Conclusion

Deploying and configuring xrdp on Linux is a straightforward process that allows you to access your Linux desktop remotely with ease. With just a few steps, you can enable remote desktop functionality and enhance your Linux experience. Remember to explore additional resources on Geekers Hub for more tips and guides!

By following this guide, you should be well-equipped to set up xrdp on your Linux system and enjoy the benefits of remote desktop access.

For more detailed information about xrdp, you can visit the official xrdp documentation