How to use xRDP for remote access to Ubuntu 14.04

To remotely control my Windows machines, I always prefer to use RDP (Remote Desktop Protocol) as it performs much nicer than VNC (Virtual Network Computing). VNC has this streak of “JPEG” quality and slow behavior, whereas RDP is fast and crystal clear.

RDP is however a proprietary protocol from Microsoft. So how can we use RDP to control our Ubuntu box remotely?

This is where xRDP comes in play, an open source remote desktop protocol (RDP) server. It actually runs VNC protocol over RDP as far as I understand, yet if behaves much better than VNC by itself (possibly because of the used desktop manager). Since Ubuntu 12.10 (if I’m not mistaken), xRDP doesn’t seem to work with the Ubuntu desktop anymore … unless you use an alternative desktop manager. This seems related to 3D acceleration and nobody seems to care (since 2011, according to bug reports).

Note : if you really need Copy/Paste functionality between the two machines, then please use Ubuntu’s default installed “Desktop Sharing” instead (MacOS X users read this forum post).

 

Desktop Manager

Since the current desktop manager of Ubuntu (Unity which runs on Gnome) no longer seems to work with xRDP, an alternative desktop manager needs to be installed.

I tried OpenBox, but wasn’t very impressed by the amount of work needed to get a reasonable desktop.

We will use another desktop manager that has been around for quite a long time is XFCE, which is lightweight and fast.

Note : A light weight desktop manager helps making a remote desktop connection much more enjoyable.

Installing xRDP and XFCE

Installing xRDP and XFCE is pretty easy, once you know what to do …

Just make sure you have an Internet connection before you start.

Step 1 – Install xRDP

We will use sudo and apt-get to update your system and install xRDP. Keep in mind that sudo will ask for your admin password.

1
2
sudo apt-get update
sudo apt-get install xrdp

Step 2 – Install XFCE4

Again we will use sudo and apt-get:

1
sudo apt-get install xfce4

  Optional, recommended by Neal, install XFCE4 terminal and 2 icons sets:

1
2
3
4
5
# Install XFCE4 terminal (way better than xterm)
 sudo apt-get install xfce4-terminal
 
 # Install icon sets
 sudo apt-get install gnome-icon-theme-full tango-icon-theme

Step 3 – Configure xRDP

In this step we modify 2 files to make sure xRDP uses xfce4.

First we need to create or edit our .xsession  file in our home directory.
We can either use nano or simply redirect an echo statement (easier):

1
echo xfce4-session >~/.xsession

The second file we need to edit is the startup file for xRDP, so it will start xfce4.

1
nano /etc/xrdp/startwm.sh

The content should look like this (pay attention to the last line):

1
2
3
4
5
6
7
8
#!/bin/sh
 
 if [ -r /etc/default/locale ]; then
   . /etc/default/locale
   export LANG LANGUAGE
 fi
 
 startxfce4

Step 4 – Restart xRDP

To make all these changes effective, restart xRDP as such:

1
sudo service xrdp restart

Testing your xRDP connection

On the computer that will remotely control your Ubuntu machine, start you RDP client.

Windows comes standard with a Remote Desktop client (mstsc.exe – you can start it from a command prompt, or find the shortcut to Remote Desktop under Accessories).

For a Mac, Microsoft actually has a Remote Desktop Client which can be found in the Apple App Store, or you can use Cord (free).

Whichever client you use, most work with either the computer network name or IP address of your Ubuntu machine.

To find the IP address on your Ubuntu box, type:

1
hostname -I

(note: this is a capital “i”)

Depending on your RDP client capabilities and settings (for example: Microsoft RDP Client allows automatic login), you might or might not see the login screen.

Here we enter our Ubuntu username and password and click “OK”, after which briefly a window will show with the login process and you’ll have access to your Ubuntu machine, even though the desktop looks different. One downside I’ve discovered so far is that the clipboard is NOT being synchronized … so Copy and Paste between machines does not work properly.

 

xRDP - Login screen

xRDP – Login screen

xRDP - Your Ubuntu xfce4 desktop

xRDP – Your Ubuntu xfce4 desktop