How to Connect Linux Server Remotely from Windows via xRDP

xRDP is an open source Remote Desktop Protocol server, which allows you to RDP to your Linux server from Windows machine and graphically control your remote server.

Choosing the Right Remote Access Solution

There are three main ways to establish a remote connection to your Linux machine or server from Windows. Each has its advantages and disadvantages.

  • SSH: Uses Secure Shell protocol to issue remote instructions with encryption.
  • RDP: Uses Windows Remote Desktop Protocol, via the open source xrdp tool.
  • VNC: Virtual Network Computing is an alternative to RDP, with or w/o SSH.

First we will use SSH command line to access and configure xRDP on Linux. Then remotely access our server with Remote Desktop. This tool is the easiest option and comes built into Windows.

This tutorial will explain how to install and configure xRDP on CentOS 7 and Ubuntu 18.04 servers.

How to Remote Desktop from Windows to CentOS 7

Let’s set up xrdp server on a machine running CentOS 7 / RHEL 7 with a minimum of 1GB RAM.

Step 1 – Install xRDP on CentOS 7

First update your package index with yum command:

yum -y update

xRDP is available in EPEL repository, so install EPEL repository:

yum install -y epel-release

Install xRDP, enable the service at system startup and start xRDP:

yum install -y xrdp tigervnc-server 
systemctl enable xrdp
systemctl start xrdp 

Configure the firewall to allow RDP connection from external machines. Add port 3389/tcp as an exception for RDP:

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

xRDP should now be listening on 3389. You can confirm this by using netstat command:

netstat -antup | grep xrdp


tcp  0  0*  LISTEN  1508/xrdp
tcp  0  0*  LISTEN  1507/xrdp-sesman

Step 2 – Install the Desktop Environment

Now we need to install the desktop environment we’ll be using. You can choose between XFCE, MATE, and GNOME.

XFCE is one of the most lightweight desktop environments. It’s fast, low on system resources, while still visually appealing. Additionally, it has a very active community, so there are many customization options available.

Install XFCE Desktop Environment

To install XFCE, run the following commands:

yum install -y epel-release
yum groupinstall -y "Xfce"

Next, create the .Xclients file in the directory of the user you’re connecting with:

echo "xfce4-session" > ~/.Xclients
chmod a+x ~/.Xclients 

Uninstalling XFCE

To uninstall XFCE from your CentOS 7 machine, run the following commands:

yum groupremove -y "Xfce"
yum remove -y libxfce4* 

Step 3 – Connect to CentOS Using Remote Desktop Connection

With xRDP and your desktop environment installed, you can now connect from your local machine to the remote machine.

To connect to your server from Microsoft Windows, just search and launch the Remote Desktop Connection application and enter your hostname or IP:


If this is your first time connecting, then you’ll receive some security warnings. Assuming this is your server and it is secure then just go ahead and confirm it.


NOTE: If you can’t connect via Remote Desktop Connection after you’ve installed the desktop environment, then open port 3389/tcp using the firewall-cmd command mentioned above.

Here is what XFCE looks like:


Now you are connected to the server using Remote Desktop Connection.

How to Remote Desktop from Windows to Lubuntu 14.04

With xRDP you can use Microsoft’s Remote Desktop to connect to a Lubuntu 14.04 server. xRDP uses vnc4server to spin up LXDE sessions on your Lubuntu machine.

Step 1 – Install xRDP on Lubuntu

Install xrdp with apt-get command:

apt-get install xrdp

Edit or create ~/.xsession with the following command:

lxsession -e LXDE -s Lubuntu

Restart xrdp:

service xrdp restart

Step 2 – Connect to Lubuntu xRDP from Windows

To connect to your server from Microsoft Windows, just search and launch the Remote Desktop Connection application and enter your hostname or IP:

In Windows, search and launch Remote Desktop Connection application. For Computer, put in the IP Address of your Lubuntu server. Leave User name blank. Click Connect.

You shall be prompted with Login to xrdp. Enter your Lubuntu username and password. That’s it.

Note: If you try connecting to your machine, you’re going to get a grey desktop. xrdp is trying to use the command “startx” to start a window manager. On Lubuntu, this will not work. You need xrdp to use the command “lxsession”.

To make this change, you need to edit /home/[your_username]/.xsession:

nano /home/[your_username]/.xsession

…and make it look like this:


/usr/bin/lxsession -s Lubuntu -e LXDE

Save .xsession, reboot your computer, and try connecting from your Remote Desktop client.

Why xRDP (Remote Desktop) on Lubuntu is not Working?

Have you already tried to use the xrdp to remotely connect from Windows to Lubuntu? Did you follow several guides but nothing worked? When trying to connect from Windows with username and password, you see some kind of blank screen and a cursor, but nothing happens after that? You might have VNC server missing.

Other than in Ubuntu the lightweight Lubuntu desktop does not include a VNC server by default. We will have to install and configure a VNC server before we are able to view our Lubuntu desktop remotely.

This can be vino (the Ubuntu default VNC server), or any other VNC server (x11vnc is good one). A VNC server can be installed and configured through an SSH session in case you have no physical access to your server.

See also:

What is the difference between yum and apt-get?

Yum is usually used with CentOS (RHEL family OS’s) and handles rpm software packages. Apt is used with Ubuntu (Debian family distributions) and handles deb software packages. Both are commands/tools used to install, remove and update software packages which are downloaded from software repositories.

  • YUM (Yellowdog Updater Modified)
  • RPM (RedHat Package Manager)
  • APT (Advanced Package Tool)
  • DEB (Debian Software Package)

Installing is basically the same, you do ‘yum install package’ or ‘aptget install package’, you get the same result.


Well done. You’ve hopefully learned how to install xRDP on a CentOS 7 and Ubuntu 18.04 machine and use desktop environment over remote desktop connection.

If you’ve encountered any issues when following this tutorial, please feel free to let me know in the comments.