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)

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

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

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

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

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

  1. Simply echoing mate didn’t work for me.

    I had to edit the startwm file to add:
    mate-session

    For anyone else with the same issue, during Step 3 in the instructions above, After issuing the echo command:

    sudo nano /etc/xrdp/startwm.sh

    One line above “. /etc/X11/Xsession” add: mate-session

  2. I have no idea why – this skript works with 15.10 absolutly well .. but with 16.04 no chance, crashs after connecting 🙁 …

  3. Hello Logan;

    Thank you for the feedback and the visit. I’m assuming that you are using the final version of Ubuntu 16.04/
    We have also noticed that echoing is not doing the trick anymore…..
    the fact to add the mate-session into the startwm.sh is the new workaround to have it working

    Till next time
    See ya

  4. Ciao thoje,

    There is again a some changes in the ubuntu 16.04 release that has changed and we need to update the post the latest release
    We still need to investigate a little bit. However, as workaround, in order to xrdp to your ubuntu 16.04, you need to add into your
    /etc/xrdp/startwm.sh file mate-session line (just after fi)
    so your file should look like this and you should be able to connect to the mate desktop via xrdp

    #!/bin/sh
    if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
    fi

    mate-session
    . /etc/X11/Xsession

    We will try to update the post in the coming days…

    Please give it a try and let us know if this is working for you
    Hope this help
    till next time
    See ya

  5. Great post, thanks for the info. I am getting a unknown command , do you have any idea why?

    Don

    don@AtticLinux:~$ sudo sed -i.bak ‘/fi/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh
    [sudo] password for don:
    sed: -e expression #1, char 1: unknown command: `�’

  6. hello there,
    let me guess; you have copy/paste from the blog the command…right
    When you copy/paste from the blog, you might have issues with the formatting…. You have this error because the single quote are not recognized as valid character.
    You have to remove them and retype them so there is no character format issue

    till next time
    See ya

  7. Hi,
    Just tried your howto, but not working for me.

    I’m can connect with rdp, but just getting a grey screen with a small terminal window in it, no mate session 🙁
    I do run mate as my main desktop aswell so didn’t have to do the installing part.

    Any idea to why?

  8. Anyone have tips using Lubuntu 16.04 for XRDP?

    Have changed startwm.sh file to below, added and removed .xession file, nothing?
    ——–startwm.sh————
    #!/bin/sh
    if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
    fi

    Lubuntu-session
    . /etc/X11/Xsession

    ——–.xsession———-
    #!/bin/sh

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

  9. I have had xrdp setup to use lxde in 15.10. I upgraded to 16.04. Now I cannot connect to the rdp session.

    During connect, I get the normal connect sequence but it does not connect. The last line just says, “error – problem connecting”

    The .xsession-errors file is below:
    ———-
    Xsession: X session started for at Wed Apr 27 11:52:34 EDT 2016
    X Error of failed request: BadValue (integer parameter out of range for operation)
    Major opcode of failed request: 109 (X_ChangeHosts)
    Value in failed request: 0x5
    Serial number of failed request: 6
    Current serial number in output stream: 8
    localuser:santonoff being added to access control list
    X Error of failed request: BadValue (integer parameter out of range for operation)
    Major opcode of failed request: 109 (X_ChangeHosts)
    Value in failed request: 0x5
    Serial number of failed request: 6
    Current serial number in output stream: 8
    openConnection: connect: No such file or directory
    cannot connect to brltty at :0
    /etc/xrdp/startwm.sh: 3: [: x: unexpected operator
    ** Message: main.vala:99: Session is LXDE
    ** Message: main.vala:100: DE is LXDE

    (lxsession:20058): GLib-GIO-ERROR **: No GSettings schemas are installed on the system
    Trace/breakpoint trap (core dumped)
    ———-
    /etc/xrdp/startwm.sh is below:
    ———-
    #!/bin/sh

    if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
    fi

    . /etc/X11/Xsession
    ———-
    user’s .xsession file:
    ———–
    lxsession -s LXDE -e LXDE
    ———-

  10. Hello there,

    We are aware that xrdp is not behaving like before with UBuntu 16.04…We are logging and tracking the current issues reported to us. in the few days we hope to be able to provide some workaround.

    in ubuntu 16.04, the .xsession file is not working anymore. You have to update the /etc/xrdp/startwm.sh
    Your file should look like this
    #!/bin/sh

    if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
    fi

    lxsession -s LXDE -e LXDE

    . /etc/X11/Xsession

    I do not know if the lxsession -S LXDE -e LXDE is still valid in ubuntu 16.04

    Please provide feedback

    Hope this help
    Till next time
    See ya

  11. Hello RAYSV,
    We are aware that some changes in Ubuntu 16.04 might break the xrdp functionalities.We have tested the procedure several time and seemed to work…
    To collect more information and try to provide workaround, can you provide us the content of your ~/.xsession-errors file so we can investigate a little bit further what could be the problem

    can you also provide the content of your /etc/xrdp/starwm.sh file

    Waiting for your feedback
    Till next time
    See ya

  12. hello jktv76,

    Ubuntu 16.04 does not seems to use .xsession files anymore….so we have to use a workaround. you need to update the /etc/xrdp/startwm.sh which should look like

    #!/bin/sh
    if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
    fi

    lxsession -s LXDE -e LXDE
    . /etc/X11/Xsession

    if the lxsession -s LXDE -e LXDE is not working, you can try lxsession -s Lubuntu -e LXDE

    Please report back so we can provide workaround and update the posts

    Thank you for you help and your visit
    Till next time
    See ya

  13. Confirmed on 3 Lubuntu 16.04 Desktop ISO/64bit.

    No .xsession file needed.

    Change /etc/xrdp/startwm.sh file to :

    #!/bin/sh
    if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG LANGUAGE
    fi

    lxsession -s Lubuntu -e LXDE
    . /etc/X11/Xsession

    Then restart XRDP, however without a restart, that gave issues. So I unistalled XRDP the re-installed it as below. Worked on the spot.

    sudo apt-get remove –auto-remove xrdp
    sudo apt-get install xrdp

    ..and you’ll be good for an RDP Connection using the Lubuntu Desktop.

  14. Thanks for the post. It all seemed to be going well until I tried to connect. I get the prompt from xrdp for the user and password however, after I enter them I get:
    connecting to sesman ip 127.0.0.1 port 3350
    sesman connect ok
    sending login info to session manager, please wait…
    xrdp_mm_process_login_response: login successful for display
    started connecting
    connecting to 127.0.0.1:5910
    error – problem connecting

    Any ideas where the problem may lie I’ave had xrdp up and running in v15. this machine is a completely from scratch new install.

  15. Hello wacker,

    can you look into log files to see what the problem could be (look for file ~/.xsession-errors.log)
    Can you ensure that a vnc server is installed correctly ?
    try to remove/re-install xrdp server package and reboot the machine

    without the log files, we cannot investigate more than this

  16. Thanks Griffon,
    My log file has 2 lines:
    openConnection: connect: No such file or directory
    cannot connect to brltty at :0
    Here is the first bit of my config:

    [globals]
    bitmap_cache=yes
    bitmap_compression=yes
    port=3389
    crypt_level=low
    channel_code=1
    max_bpp=24
    #black=000000
    #grey=d6d3ce
    #dark_grey=808080
    #blue=08246b
    #dark_blue=08246b
    #white=ffffff
    #red=ff0000
    #green=00ff00
    #background=626c72

    [xrdp1]
    name=sesman-Xvnc
    lib=libvnc.so
    username=ask
    password=ask
    ip=127.0.0.1
    port=-1

  17. can you confirm that you have vnc server running on your machine ? you .xsession file show that you do not try to connect
    have you tried to remove/install xrdp and reboot the machine ?
    Can you have a look at logs (for xrdp) in /var/logs ?

    For info, we have try the process yesterday and everything seems to work….

    Till next time
    See ya

  18. The screenshot after:
    sudo sed -i.bak ‘/set -e/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh
    is out-of-date. Have you tried deploying an Azure Ubuntu 16.04 LTS server to test this before?

  19. Hello Andres,

    You are right, we didn’t got the chance to update the screenshot for the startwm.sh. As you probably know, the ubuntu 16.04 has introduced some changes and we had to react quickly in order to provide a working workaround. we have quickly updated the post to provide such info and we now need to finalize the changes

    Thank you for letting us know and for your feedback
    till next time
    See ya

  20. Thanks Nair,

    Good to see that information sharing is ongoing on this topic 🙂
    Thank you to all of you trying to provide an easy and effective way to implement xrdp

    Till next time
    see ya

  21. Works for me, keymap included, but I am still missing the clipboard functionality, can not make it work with xubuntu 16.04 and xrdp package from the distro (with sesman-Xvnc and vnc4server)

    Also, any chance someone will provide a ppa with a more modern version of xrdp? I have compiled it, but it is definitely not a beginner’s task, and I do not know how to make a proper .deb out of it.

  22. sudo sed -i.bak ‘/set -e/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh
    Dosen’t work form me. No changes in /etc/xrdp/startwm.sh. When connect via RDP get grey desktop. Im using KDE, use startkde instead of mate-session

  23. @Denis,

    the sudo sed -i.bak ‘/set -e/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh should add a line into your startwm.sh file
    can you confirm that the command above add the line mate-session in your file. Pay attention to the formatting, if you copy/paste from the blog to the terminal window, it might not work. the single quotes needs to be retyped

    if you are trying to use Kde with plasma 5.x, xrdp does not seems to work with it. You have to fallback to another remote desktop solution
    If we have time, we will try to investigate for kde desktop as more people are asking for it

    Till next time
    See ya

  24. @Griffon,
    Thanks. i’ll be try with another desktop. Hope you’ll someday solve issue with KDE.

  25. I connect fine but my issue is the screen and any actions taken on rem connection do not effect the screen of the linux box im connecting to.. any way the 2 displays could display the same thing?

  26. Hello Kerry,

    xrdp does not offer you a direct way to connect to the console. Xrdp uses a virtual desktop to perform the connection….
    in order to meet your requirements, you would need to use vnc solution.
    you can use the following instruction to have a pure vnc solution (http://c-nergy.be/blog/?p=8984)
    If you want to directly connect to the console via xrdp, you can try this quick and dirty trick (see http://c-nergy.be/blog/?p=5956)

    hope this help
    Till next time
    See ya

  27. Hello Vlad,

    Grey screen are usually a sign that either alternate desktop has not been installed or startwm.sh file is not containing the correct information
    Can you check the content of the /etc/xrdp/startwm.sh and confirm that the mate-session line parameter is added accordingly
    Check logs files to see if any errors are popping up (var/log/xrdp.log)
    Check your ~/.xsession-errors file to see if any error related to your issue is recorded…

    If I check your screenshot, I see that you are using Ubuntu 16.04 server edition, right… If you are trying to perform this on a server, you might end up with some issues/errors(as the post was written for desktop version). If you wait some days, we will be publishing a post about using xrdp on Ubuntu 16.04 server

    How did you perform the install of the ubuntu server . Which additional package have you installed (if any) ??

    Waiting for your feedback
    Till next time

  28. Hello Pawar,

    Thank you for the visit and the positive feedback… We are happy to see that our work is useful in some ways
    Till next time
    See ya

  29. Hi there,

    first of all, thanks for this tutorial, it has helped me a lot. Second of all, I’m having some problems when running programs via xrdp. When I successfully connect to Ubuntu from Windows, I’m not able to run some programs (e.g. firefox, eclipse). If I try to run them from the command line, they give me a Segmentation fault (core dumped) error, and this only happens via remote desktop, so I don’t have any problems to run them locally.
    I have been looking for similar cases, but I have not found anything. Do you know what might be happening? Thank you.

  30. Hello Chinmway,
    Thank you for visiting our blog and providing us positive feedback on this topic
    Till next time
    See ya

  31. @Guim,

    we never encountered this kind of issues.. We cannot really help here…..
    We will try to test and see if we have issues using fireforx during a remote session

    Till next time
    See ya

  32. Hi, Griffon,
    I downloaded the latest 16.04 (19/05/2016), and followed your instructions.

    When i use the Windows 10 “Remote Desktop Connection”, i always encountered the following msg and cannot log in. Do you have any hints? Thank you very much.

  33. It Works perfectly for me

    Ubuntu 16.04 XRDP

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

    To configure this, issue the following command in your Terminal console

    sudo sed -i.bak ‘fi/a#xrdp multiple users Configuration \n echo mate-session >~/.xsession\n’ /etc/xrdp/startwm.sh

    go to the /etc/xrdp directory

    setxkbmap -layout be

    sudo cp km-0409.ini km-0409.ini.bak

    sudo xrdp-genkeymap km-0409.ini

    sudo vi /etc/xrdp/startwm.sh

    One line above “. /etc/X11/Xsession” add: mate-session

    RESTART YOUR PC

  34. With the above config, xrdp on 16.04 works flawlessly. Be careful when copying/pasting the sed session command.

  35. @John,

    Thank you for the feedback and positive feedback on this post. Thank you also for mentioning that copy/paste code from the blog does introduce some issues because formatting of the text. If you copy/paste command from the blog, you will definitely need to check for text formatting and adapt accordingly

    Till next time
    See ya

  36. @SatHeesh

    I think you are using the older version of the sed command (sudo sed -i.bak ‘fi/a#xrdp multiple users Configuration \n echo mate-session >~/.xsession\n’ /etc/xrdp/startwm.sh)

    In this post, we have updated the sed command to look like (sudo sed -i.bak ‘/fi/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh)
    For info, the sed command simply add the mate-session line into your startwm.sh file…..

    Thank you for the feedback

    Till next time
    See ya

  37. I need the script to do this in xubuntu 16.04. Before the upgrade from 14.04 xrdp worked fine using the scripts from scarygliders now nothing I could try to just alter your directions for the other desktop environments but am afraid of causing big problems, thank you. I wish linux would spend more time getting remote to work better as it is a major requirement now for many people.

  38. same problem @Guim .. using mate, running any apps except terminal I get “Segmentation fault (core dumped)”

    Almost fresh installed 16.04, tried running with a different user in case…. Help @Griffon !

    Everything works fine except I can’t run any apps

    next step would be to install a different WM to see if problem persist…… what do you think?

  39. It seems it has to do with the fact that my system is installed using x64… any idea? I tried using package “ubuntu-mate-core” instead of “mate-core”.. looks like the equivalent but in 64… but same result.. any advice?

  40. @GuillaumeD,

    Again, we never experienced such issue so far and we are using 64-bit version of Ubuntu… As we are quite busy working on multiple projects and more an more people are asking support for xrdp, you might need to wait a little bit before we are coming back to you with a possible solution or no solution at all..

    Till next time
    See ya

  41. @GuillaumeD,

    Can you provide details instructions on how you performed the xrdp installation so we can see if we can replicate your issue

    Till next time
    See ya

  42. What is the procedure to undo the install of mate desktop, xrdp and get the old desktop back?

    sudo apt-get remove xrdp
    sudo apt-get remove mate-core mate-desktop-environment mate-notification-daemon

    This is not working for me. I must be missing something?

Leave a Reply