XRDP – How to install XRDP on Ubuntu 16.04 – Easy Way

XRDP_U1604

 

Important Note :

If you want to use xRDP in conjunction with the Unity Desktop interface, please check the following post : XRDP – How To Remote Connect to Unity Desktop on Ubuntu 16.04

 

Hello World,

In our previous post, we have quickly provided a step by step instructions on how to perform a fresh installation of Ubuntu 16.04. If you are working with Ubuntu since a long time, you know that no major changes have been introduced in the setup process and wizard.  It’s quite straightforward.

xrdp is a great solution when you need to have coexistence between Windows machines and Linux machine.  xrdp is basically a piece of software that allows you to remote desktop into your Ubuntu machine from a Windows computer.  On the Windows machine, you do not need to install any tools, you simply use the standard and builtin tool Remote Desktop Connection.

In the past, we have described how to install xrdp on the previous releases of Ubuntu( 15.10,15.04,14.10,14.04,..).  The process described to install xrdp on Ubuntu 16.04 is exactly the same as the one described for machines running Ubuntu 15.10. So, instead of going really deep into details, we will provide hereafter the necessary steps needs to be performed in order to have xrdp installed on your system.

So, let’s go

Standard XRDP installation on Ubuntu 16.04

Assumptions

For this post, we have make some assumptions.

  • Ubuntu 16.04 (Final Release version) is used
  • The Mate-desktop will be installed on the machine (as alternative desktop environment)
  • We will configure our system to match on localized version (i.e. we are using a Belgian french keyboard)
  • Since Ubuntu 15.04, upstart has been replaced by systemd component. The systemd component is used in our scenario
  • No additional configuration is needed to reconnect to the same session if you are using the latest version of the xrdp package found in the Ubuntu Repository

Installation Process 

Step 1 – Install XRDP Package from Ubuntu Repository

A standard installation for us means that we will be using the xrdp package available within the Ubuntu repository. To install the xrdp software from Ubuntu repository, you will need to issue the following command in a terminal.

sudo apt-get install xrdp

Because of the sudo command, you will be prompted for a password. After entering your password, you will be asked to confirm your action by pressing Y (see screenshot below)

U16_Xrdp_1

Click on picture for better resolution

Step 2 – Install an alternative Desktop 

xrdp and Unity desktop (or Gnome 3) are not working well together.  If you do not install another desktop environment, when you will try to connect to your Ubuntu machine, you will see only a gray screen.  The workaround to this situation is to install an alternate desktop that can work with xrdp software solution.

Our preferred desktop alternative is Mate-Desktop.  This post will show you how to install the Mate-Desktop and have it working with the xrdp software solution.

To install the Mate-desktop, issue the following command from the Terminal Session

sudo apt-get update

sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

Note :

Desktop interface such as xfce, LXDE,LXQT, KDE  are all potential candidates.  Check the following links for more information and installation and configuration procedures

 

Step 3 – Configuring xRDP to use your desktop environment

At this stage, we need to configure our system in order to tell xrdp that an alternate desktop needs to be used.  In our case, we have to tell xrdp that we want to use Mate-Desktop as alternate desktop. With the previous version of Ubuntu, you would need to create the ~/.xsession file.  In Ubuntu 16.04, it seems that this approach is not working anymore.  We need to configure the system differently when working with Ubuntu 16.04

Starting the alternate desktop environment 

Important Note : 

In our scenario, we have installed mate-desktop, If you have installed another Desktop alternative, you will have to adapt the configuration of the startwm.sh file to reflect your settings.

If you use the  ~/.xsession file approach, you will experience the same symptoms as before i.e. grey screen. We will need to configure the system in a different way.  To have xRDP working in Ubuntu 16.04, you will need to  update the /etc/xrdp/startwm.sh file. To configure this, issue the following command in your Terminal console

sudo sed -i.bak '/fi/a #xrdp multiple users configuration \n mate-session \n' /etc/xrdp/startwm.sh

ubxprd16.04

Click on picture for better resolution

Note :

Remember that the command above is to be used when you have installed the Mate-Desktop.  If you have installed a different desktop environment, you will need to adapt the command accordingly. Please check the following links

Step 4 – Configuring xRDP Keyboard 

By default, the xRDP login screen will use an en-us keyboard layout. You remote session will also be using the en-us keyboard layout.  If you are using a different keyboard layout than the english one, you need to perform the following actions in order to update the configuration of the xrdp software.

In my case, I’m using a Belgian French keyboard, so I had to tell xrdp to use the belgian french keyboard as well.  To do that, you need to perform the following actions :

Step 1 : You go to the /etc/xrdp directory

Step 2 : you issue the command setxkbmap -layout <%your layout%> to define which keyboard map/layout to use

XRDP_15.04_5.PNG

Click on Picutre for better Resolution 

Step 3 : create a copy of the km-0409.ini file into the same directory. It seems that this is the default file used by xrdp to define the keyboard layout. You will need to use sudo in order to be able to write into the directory

Step 4 : Check that you have a backup of your file by typing the dir or ls command

Step 5 : update the file by issuing the following command sudo xrdp-genkeymap km-0409.ini

XRDP_15.04_6.PNG

Click on Picutre for better Resolution 

Step 5 – Reconnect to the Same Session

Since Ubuntu 14.10, a new xrdp package has been made available in the Ubuntu repository. This package fixes a long time issue related to the fact that users could not reconnect to the same session.  If you are using the package xrdp 0.6.1-1, you do not need to perform any customization, you will reconnect automatically to the same session.

Final Notes

As we can see, the installation process has not changed much and after performing all the necessary configuration steps, you should be able to connect remotely to your Ubuntu machine using the Remote Desktop Connection tool.

Some people are still facing some issues while using xrdp.  If you have any issues, connecting or using xrdp, please leave a comment and will contact you back in order centralize and collect as much information possible about the issue and publish the workaround founded (if any) for the mentioned problem.

That was an easy post  🙂

Till next time

See ya

261 thoughts on “XRDP – How to install XRDP on Ubuntu 16.04 – Easy Way

  1. @Vivek,

    euh, that’s kind a new issue here… If I look at the picture, you are using remmina RDP Client, right ? have you any settings there that can be tweaked (color depth, screen resolution…) ? Do you have nvidia drivers installed ? known to create some issues

    Do you have the same issue if using ms rdp client tool ? As I cannot reproduce the issue, It will be difficult for me to troubleshoot…

    If you fix it, let us know so we include this information in a blog or FAQ page about xrdp…(a new one that needs to be created 🙂

    Hope this help
    Till next time
    See ya

  2. @Jack,

    can you check this post (http://c-nergy.be/blog/?p=11880) maybe your problem is simply related to the theme used on your system….. Have you checked which theme is used Ambiance, Radiance… if you change that, do you have your initial configuration. installing xrdp should not modify the theme on the local session. and if the theme session in he remote session, you can set back to the correct theme settings through the control applet in Ubuntu
    Hope this help
    Til next time
    See ya

  3. Hi,
    your instructions are great. I have been using XRDP on many servers and it has always worked beautifully.

    I have one question. When sitting in front of the server how can i switch from CLI to GUI. Right now i only have GUI when using remote desktop app. i would like to be able to sit in front of the server and switch to a GUI.
    is it possible?

    Thank you

  4. @Eric,

    So, based on your question, you are working on Ubuntu Server Edition ? Right ?. If this is the case, we assume that you have installed a desktop environment…
    the easiest would be to login into the server in the console (command line) and type startx…. This should start your desktop environment….

    Hope this help
    Till next time
    See ya

  5. Followed instructions above.
    But

    sudo setxkbmap -layout GB
    Cannot open display “default display”

    also setxkbmp doesn’t exist in /etc/xrdp

    odroid@odroid:/etc/xrdp$ ls
    km-0407.ini km-040c.ini km-041d.ini startwm.sh
    km-0409.ini km-0410.ini rsakeys.ini startwm.sh.bak
    km-0409.inicopy km-0419.ini sesman.ini xrdp.ini

    running Ubuntu 16.04 on Odroid C1

  6. @John,

    the setxkbmap is not a xrdp utility but a standard linux tool to configure keyboards from command line. The error message you are getting is generally because you are executing the command from the remote session…. You have to run the command on the computer when you are locally connected to and this should be working

    Till next time
    See ya

  7. Sir,
    we are using thin client for University and I am facing some issue in connecting the server and thin client. seeking help

  8. @Shashank,

    sorry for the delay in answering….had a crazy week… Which kind of issues are you facing ? are you looking for free help and advice or commercial support

    waiting to have some more info
    Till next time
    See ya

  9. HI I followed your mate-desktop and xrdp installation above on ubuntu18.04.
    i enjoyed xrdp for one day.
    then next day, i installed Firefox and i exited and came back to login, and now i am faced with this error message:
    “Could not acquire name on session bus.”
    It is a dialog box on a black screen, with a cancel button. cancelling, does nothing, and i am stuck in a black screen.
    I am loging in from windows 10 rdp on same LAN. i choose the default “xorg” when i log in.

  10. @Fawzi,

    This might be an issue relate to Mate-desktop instead of xrdp…You have two options here…..either try to install another Desktop environment…or try to modify the /etc/xrdp/startwm.sh and add the following line

    unset DBUS_SESSION_BUS_ADDRESS
    at the end of the file (more specifically under the fi section and give it try

    Hope this help
    till next time
    See ya

Leave a Reply