How to install xRDP server on Ubuntu 14.04 Unity

The xRDP client for Linux is a popular way to get a remote desktop session to your Linux Server. Some users may not want to use tools like Xsession to pull graphical applications direct from the command line. The procedure will explain how to install xRDP and config it so you re not stuck with a black screen when connecting.

xrdp provides a graphical login to remote machines using Microsoft Remote Desktop Protocol (RDP). xrdp accepts connections from a variety of RDP clients: FreeRDP, rdesktop, NeutrinoRDP and Microsoft Remote Desktop Client (for Windows, Mac OS, iOS and Android).

RDP transport is encrypted using TLS by default.

xRDP Features

There are several cool features you get when you install xRDP, not only can you connect to any Linux computer from anywhere, but you can reconnect to a pre-existing session, this is actually surprisingly difficult to do in Linux due to the way the kernel handles user sessions.

You can transfer files, clipboard content, and audio between the host and the guest. All you need is port 3389 open and you are good to go.

How to install xRDP server

On Ubuntu based Linux distributions, xRDP is now included in the default repo’s, all you need to do is type:

sudo apt install xrdp

If you use Redhat or Centos you first need to enable EPEL packages before installing:

sudo yum install epel-release
sudo yum install xrdp

On Red Hat and CentOS version 8, replace yum in dnf

Once installed, you will have the following directory structure:

xrdp
├── common ······ common code
├── docs ········ documentation
├── fontdump ···· font dump for Windows
├── genkeymap ··· keymap generator
├── instfiles ··· installable data file
├── keygen ······ xrdp RSA key pair generator
├── libpainter ·· painter library
├── librfxcodec · RFX codec library
├── libxrdp ····· core RDP protocol implementation
├── m4 ·········· Autoconf macros
├── mc ·········· media center module
├── neutrinordp · RDP client module for proxying RDP connections using NeutrinoRDP
├── pkgconfig ··· pkg-config configuration
├── sesman ······ session manager for xrdp
├── tcutils ····· QT based utility program for thin clients
├── tests ······· tests for the code
├── vnc ········· VNC client module for xrdp
├── vrplayer ···· QT player redirecting video/audio to clients over xrdpvr channel
├── xrdp ········ main server code
├── xrdpapi ····· virtual channel API
├── xrdpvr ······ API for playing media over RDP
└── xup ········· X11rdp and xorgxrdp client module

Credit: https://github.com/neutrinolabs/xrdp

Troubleshooting Older versions of Ubuntu / Red Hat

This is a summary of a support job I did for a customer.

Scenario: The customer was stuck using Ubuntu 14 for a production database, 2 users based at different places around the world. Each time they logged in they would get a black screen or a blank session.

Project details: xRDP Ubuntu is Remote Desktop Protocol (RDP) client for Ubuntu, the Unity desktop for Ubuntu 14.04 is now obsolete and is being replaced by GNOME. GNOME has been available in versions 15 and above. Unity has been used in Ubuntu since approx. 2012.

Unity was dropped as it has several compatibility issues with Ubuntu plugins, including problems with authenticating an x RDP Connection. xRDP can be configured to use listen on port 3389 (Remote Desktop Protocol (RDP) just like the Microsoft Windows remote desktop protocol.

You will need:

  • SSH terminal access to the server
  • Sudo root access

Step 1 – Confirm which version of Linux you are running

Make an SSH connection to the Ubuntu Server using putty or your favourite terminal.

Confirm the version of Ubuntu that is running by typing:

lsb_release -a

Confirm the version of Ubuntu desktop that is running by typing:

dpkg -l|grep unity

or, if you are not sure which version you are running, type the following:

dpkg -l|egrep -i "(kde|gnome|lxde|xfce|mint|unity|fluxbox|openbox)" | grep -v library

Step 2 – Installing xRDP on Ubuntu 14.04

The next step is to install the xRDP client onto Ubuntu. Open a terminal session and type:

sudo apt-get install xrdp -y

The installation will only take a few seconds to complete, make a note of these important file locations:

${XRDP_BIN_DIR}/xrdp
${XRDP_CFG_DIR}/xrdp.ini
${XRDP_LOG_DIR}/xrdp.log
${XRDP_PID_DIR}/xrdp.pid

Step 3 – Install alternative Desktop Environment (XFCE)

Open terminal and type:

sudo apt-get update
sudo apt-get install xfce4

Step 4 – Configure xRDP to use XFCE

This will force xRDP to use the XFCE desktop instead of the packaged UNITY desktop.

This change will only affect the xRDP desktop experience. On the AWS console you will see a different wallpaper, but the same Unity server.

This change is persistent and will remain in place if the server reboots

echo xfce4-session ~/.xsession
sudo service xrdp restart

Step 5 – Access Ubuntu with RDP

Make sure you have the Ubuntu server hostname or IP address to hand. To get this you can type

On the console type:

hostname -I
ip addr show

From your Windows Desktop Machine or local desktop, Open Remote Desktop Connection. You can simply type mstsc from the command line or from the start menu

mstsc
, How to install xRDP server on Ubuntu 14.04 Unity

You will be prompted to connect to the server vis xRDP

, How to install xRDP server on Ubuntu 14.04 Unity

A connection log will popup. This will tell you the process of the XDRP login and errors you may have.  The most common error is password failure.

xRDP Connection log connected

Step 6 – Configure console / admin sessions on xRDP

**IMPORTANT**

Every time you log into an xRDP session the server will create you a new logon session ID. This can be frustrating if you are disconnected, the server will, by default, connect you to a new session. To allow true admin or console xRDP access you need to do the following.

Edit the xrdp.ini

sudo gedit /etc/xrdp/xrdp.ini

Edit lines

Port =-1 change to port=ask-1

xRDP port configuration for console access

Restart the xRDP service

sudo service xrdp restart or sudo systemctl restart xrdp

You can check the status of the service with

sudo systemctl status xrdp

Please Note that If you are connected via xRDP you will be disconnected

Open Remote Desktop and reconnect to the server.

On the connection log make a note of the port highlighted below. In my example its 5914, it will most likely be different on your AWS config.

xRDP Session Logon Screen

Disconnect from that session.

Now, reopen Remote desktop and connect to xRDP

xRDP Session Logon Screen

This time enter the port number when connecting.

You will now be able to log straight back into any saved work.

How will it look from the AWS console?

Login in screen wallpaper will change, but it will still be Unity underneath:

xRDP Logon Screen running on Ubuntu Unity

Post log in on console

xRDP logged on session

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *