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



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


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

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

  1. Anyone got multiple screens working? I’m choosing W10 option “Use all my monitors for the remote session”, but no dice. Is this a non-starter?

  2. @Brendan,

    never tried mutiple screen yet ? Do not know if this is supported or not ? Will need to investigate

    Till next time
    See ya

  3. Hi

    Thanks for this nice and helpful post.

    May I also request for some additional help and guidance please?

    I have installed Ubuntu 16.04 desktop for sole purpose of hosting vrtualbox VMs, which I may need remote access.

    Being default installation, it has installed lot of unwanted thngs like Libre office, Unity desktop etc (have installed Mate after reading your article). Can you please guide as how to remove these extra softwares to save on disk/RAM and improve security and performance.

    Thanks in Advance

  4. When I run the command:

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

    I get this error:

    sed: -e expression #1, char 28: unterminated `s’ command

    I don’t know much about SED, but I can’t find that there is a “/fi” command. Should this be “/if” instead? Or maybe just “/f”?

  5. @ankush,

    Sorry not to provide better info because we are lacking of time at the moment. an easy way to uninstall software would be to use the Ubuntu softwware. From there, you should have the option to remove installed software

    Hope this help
    Till next time
    See ya

  6. @Gray,
    For a quick fix, edit your /etc/xrdp/startwm.sh file and add manually the mate-session information .

    The command should be correct, the sed will add after /fi line the additional text….Possibly the contentn of the startwm.sh has been modified and the pattern search is not valid anymore….

    We will check for that

    Hope this help
    till next time
    See ya

  7. How do I logout of the session? I don’t have the buttons on the panel, and the command doesn’t work either?

  8. @Drew,

    which Desktop interface are you using ? are you using mate desktop ? have you tried to use the command line instead of the GUI interface ?
    have you checked for newer post about xrdp and Ubuntu 16.04 (see http://c-nergy.be/blog/?p=10752) ?
    waiting for feedback….

    Hope this help

    Till next time
    See ya

  9. I’m running Ubuntu 17.*. When I follow the directions above and RDP in, I get the login screen but after login my screen in completely blank. And blue.

  10. hi,

    works great except that when i try to use chronium, the display is back at the console?


  11. @Ray,

    Thank you for the feedback and comments… are you using any Nvidia graphic cards ? have you installed drivers for them ? this might be the problem as some people mentioned that using Nvdia Drivers would prevent to launch applications or crash the system. Is the problem only with chromium or Firefox would present same symptoms ?

    Let us know so we can collect these information and try to have a look into it

    Till next time
    See ya

  12. Any chance you can post something showing how to enable RDP with Lubuntu desktop environment?

    Thanks for your documentation this is great, and a way better solution to VNC

  13. Hi guys,

    not so difficult.

    Just install xrdp as mentioned in step1.

    Then on windows 10 use sth like tight vnc to connect and you’re all set.

    best regards


  14. Hey all,

    it’s much easier.

    proceed as mentioned in step 1

    use tightvnc on the windows machine and log into the ubuntu-machine.

    All fine without installing a second desktop on the ubuntu machine.

    best regards

  15. Hello
    I set up a Ubuntu Desktop to accept RDP connections and it works great. However from only one windows computer. I do not recall specifically allowing only one computer. All three computers involved are on the same network. Where can I look to find out what the issue is?
    Thanks in advance

  16. @Jason,

    are you using the same user account from these different computers ? Remember that you can only have a single connection to the Remote System (either console or Remote Session). You have to logout from remote session from computer1 and then log into computer2 and you should be able to connect to Ubuntu via xRDP

    Hope this help
    Till next time

  17. @Raul;

    Thank you for the visit and the positive feedback…. Happy to see that’s working ! Other posts about xrdp and Ubuntu 16.04 and 17.04 and 17.10 are available….
    Stay tuned

    Till next time
    See ya

  18. @Remco,

    in the post there is a link that redirect you to a post about using lxqt environnement (http://c-nergy.be/blog/?p=6692). This post is a little bit out dated but if you use the command startlxqt, this should be still working
    We are assuming that you are still using ubuntu 16.04 with the old xrdp 0.6.xx package

    Hope this help
    Till next time
    See ya

  19. @Griffon yes Ubuntu 16.04 not sure which xrdp version I have. How can I check that?
    I tried both commands. Sorry I am a bit noob.
    echo startlxqt >~/.xsession (worked for me)
    But I was not able to restart the vps, so I did a full reboot of my vm.
    Now I am able to see the Xrdp login box. When I login with Sesman-Xvnc I get a grey desktop.
    Any idea?


  20. The desktop is hexed black/ grey. When I right click I have some options. But it’s not the full desktop manager.

  21. Dear Griffon,

    I used this guide to get the X of my machine, and it seems very good
    I need this machine for python development and I am getting Qt problems in all IDEs.

    e.g. this is the probelm I get while using spyder:

    QXcbConnection: Failed to initialize XRandr
    Qt: XKEYBOARD extension not present on the X server.
    Qt: Could not determine keyboard configuration data from X server, will use hard-coded keymap configuration.
    Qt: Failed to compile a keymap!
    Current XKB configuration data search paths are:
    Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, add ‘:’ as separator to provide several search paths and/or make sure that XKB configuration data directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .

    can u help me in that ?

  22. Thank you for this tutorial that works perfectly.

    I just have a little problem: the Alt Gr key moves the cursor back when I connect to xrdp.
    In hyper-v console connection, I have no problem.

    Do you have a solution to this problem?

    Thanks in advance


  23. Hi.
    I’m not a linux guru but this command
    sudo sed -i.bak ‘/fi/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh
    added the line in startwm.sh file. In the result I had ‘mate-session’ and . /etc/X11/Xsession lines in the file. Is that intention?
    Regards, Dawid.

  24. WOW – had to leave a comment – installed xfce4 but could not fix the keyboard layout issue.

    Followed these instructions working great, so far.

    Thanks for taken the time… to help.

  25. @Ru U,

    Thank you for the visit and the positive comments. we are already working on posts about Ubuntu 18.04 and xRDP so keep in touch
    Till next time
    See yaa

  26. @dvn,

    Thank you for the visit and the positive feedback. These comments helps us confirming that the solution provided in these posts are replicable to others and validate them
    Till next time
    See ya

  27. how silly is it that linux doesn’t provide an out of the box solution for this…

    getting vnc working has been travesty for ages

  28. @Etymal,

    Thank you for the visit and the feedback….We also think that remote desktop solution should be default in Linux
    Till next time
    See ya

  29. I have had to re-install Ubuntu 16.04, and xRDP, as I have done many times before using c-nergy instructions.

    Usually it works fine, but this time, whenever I use remote desktop to connect, after I enter username/password, it scrolls through the grey post-login console messages (top left of rdp screen), then the rdp screen goes grey for a second or two, then the rdp login windows closes on my PC.

    Any idea what might be going on, or how I can debug?

  30. @Stevod,

    We have just tried the install on Ubuntu 16.04 update 4 and it seems to work as expected….
    Which version of Ubuntu are you using ? (latest one with all updates”, which desktop interface are you using (Mate,xfce,…) ?

    to troubleshoot this, you can always check the following log files
    and ~/.xsession
    Check the status of the XRDP service (is this running or failing ?)

    if you read through this post (see (http://c-nergy.be/blog/?p=10887), you will see that there is also a debug mode available in xrdp
    Another option is to remove/reinstall xrdp and see if this is working….

    by the way do you know that you can use Unity Desktop with xRDP if you perform a custom installation of XRDP ? You can look in the blog to find some guides and explanations.. You might want to give it a try

    Hope this Help

    Till next time
    See ya

  31. Please note you also need to allow port 3389 through the firewall
    sudo ufw allow 3389

  32. @Johan,

    Yes indeed, firewall port 3389 should be open in order to perform the connection… Thank for the visit and the comments
    Till next time
    See ya

  33. I have the same problem as Stevod:

    I have a laptop and a desktop both with Ubuntu Mate 16.04 LTS totally updated. First I had Remmina version 1.1.2, but now tried with Remmina version 1.2.

    The laptop seems to connect fine to the desktop (I had to fiddle with the resolution and colors, but after that everything was good), but the desktop has the behavior described by Stevod when trying to connect to the laptop. It says “password ok”, blablabla, “connection complete”, then the grey screen with two crosses for a couple of seconds, and then suddenly the Remmina window simply disappears.

    I assume in your comment you refer to the logs on the server computer (the laptop)… Unfortunately, I can’t make anything out of “.xsession”, “xrdp-sesman.log” doesn’t exist, and “xrdp-sesman.log” simply says:

    [INFO ] scp thread on sck 7 started successfully
    [INFO ] ++ created session (access granted): username xxxx, ip 192.168.1.x:52996 – socket: 7
    [INFO ] starting Xvnc session…
    [INFO ] starting xrdp-sessvc – xpid=17163 – wmpid=17162
    [INFO ] ++ terminated session: username xxxx, display :10.0, session_pid 17160, ip 192.168.1.x:52996 – socket: 7

    The xrdp service seems to be active in both computers. However, I can’t connect unless Remmina is also open in the server computer, or I have executed in the terminal the command “service xrdp –full-restart”.

    I also saw people saying that you should change “allowed_users=console” to “allowed_users=anybody” in the “/etc/X11/Xwrapper.config” file, however, this file was nowhere to be found in my laptop. Finally, I discovered that the package “xserver-xorg-legacy-…” was installed in my desktop but not my laptop. After installing it, I finally found and could edit the file, but still nothing has changed.

    I’ve run out of things to try… Anything, anyone?

  34. @Margaret,

    This is a difficult one….based on your comments/description, you are using an old xrdp package (ver 0.6-x)…
    Does the laptop is using nvidia drivers (which is know to make xrdp difficult to use…) ->uninstall them and test
    in the file /etc/xrdp/xrdp.ini can you comment the line channel_code=1 and see what happens ?
    have you tried to use the xrdp debug mode to see if you can get more logs….

    provide feedback on ths topic if one of the suggestion works for you

    hope this help
    till next time
    see ya

  35. Hi,

    I am running XRDP (on UBUNTU MATE 16.04) and connecting 30 Thin client stations. Connection is working perfectly. The only problem are the following:
    1. When a thin-client station user shut-downs or log out of the station, the screen goes to a terminal window and a Tilda window. If you do a 2nd shutdown/log-out from the System menu, thats the only time it would completely log-out/shutdown

    2. Configured and followed the instructions on how to redirect audio using PulseAudio, but there is still no sound coming pout from the Thin clients. I’m using centerm c91v2 thin clients.


  36. @ninia_0,

    Thank you for your feedback and your valuable experience… For the logout/shutdown, this is a know issue and indeed sometimes it works as expected some times you need to click twice on the button to have the action executed
    The sound redirection in xrdp needs an additional configuration (xrdp and pulse audio) which we never explained on this blog. some tutorials are however available on the internet if you really want to have sound redirection in your infrastructure

    Till next time
    see ya

  37. Thank you for writing up this guide. I have struggled for some time with ultra-slow VNC on my Ubuntu Plex-server, but now after setting up xrdp it’s super-fast! Saves me tons of time when I don’t have to do everything in PuTTY 🙂

  38. @Vegar,

    Hey, no problem, we are happy to see that our works can be used and shared by people… Thank you for the visit and the feedback
    till next time
    See ya

  39. So let me preface this by saying this worked for me.

    However, it messed up my normal unity desktop settings. I’d like to reset my ubuntu desktop back to default. The problem is in the way the windows and status bar look. In addition, the terminal has changed to a white background with black text and the font isn’t normal. Most of the icons are just blank now as well.
    Any idea on how to get back to default? I’ve tried dconf reset -f / with no luck. All that does is put the default icons back in the launcher.

    Thanks in advance

  40. Hey dude
    I am able to connect to the remote sever but everything looks super pixelated/fuzzy. I have attached a screenshot of how it looks below. Can you help me with this?

    great post btw 🙂

Leave a Reply