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. pm i cant get this to work on kali linux followed this tut plus a million other as well as playing around with it.

  2. @James

    We never tried on Kali but if we have time, we might have a look into it and see what could be the problem….

    Till next time
    See ya

  3. Hello,
    I continue to have problems with my apple keyboard , the up arrow fails with xrdp on Ubuntu 16.04 and Microsoft Remote Desktop running on a OS 11.6 box.

    I am using an en keyboard (US english).

  4. I found that if there was a prior installation of xrdp on 14.04 and you upgrade to Ubuntu 16.04, you first have to purge the original installation, and then install the xrdp package to get the keyboard arrow and other special keys to work.
    I am using a us en keyboard, and did not have to update the km-409.ini file. I am using the file that came with the installed package.

  5. Hi,
    Great article and thanks for taking the time to post, I do have a question though, when I issue the command in step 2 : “you issue the command setxkbmap -layout to define which keyboard map/layout to use”

    I use setxkbmap -layout gb, (and tried a few different countries) however no file is generated, using both my credentials and sudo .

    Any thoughts?

  6. @Charles,

    Good to hear to you might have found your solution because so far we had no clue
    Thank you for sharing your findings with our community

    Till next time
    See ya

  7. @Hibbs,
    setxkbmap does not generate any files. It simply set keyboard layout
    Step 5 generate ini files

    Hope this answer your question
    Till next time

    See ya

  8. @Griffon,
    Thanks a lot, was the end of a long week, mis-read completely which is dumb – I must have set up hundreds of xRDP before 😉

    Thanks again.

  9. So I set it up and RDP was working fine. Now after a reboot, I’m getting a “Unable to connect to RDP server” error.

    I’m running Ubuntu 16.04.1, is there any service I should check to make sure it’s running?

  10. @Vincent,

    To check that xrdp service and vncservice are running.
    Check logs files to see if some hints can explain why service is not starting as expected

    Till next time
    See ya

  11. Have issues since the 16.04.1 upgrade. Any tips? Running Ubuntu LTS 16.04.1 with Lubuntu Desktop. XRDP this way worked all all previous versions, 3 attempts on new VMS gets us to the log in screen, but the log in never goes through. As in we can see the desktop and user id, we type in password and nothing, just error.
    ——————————
    started connecting
    connecting to 127.0.0.1 5910
    error – problem connecting

    Then we click the OK button, goes to user id and password, nothing lets us log in. Very odd. Any tips?

  12. @Jesse VK,

    This kind of error could be generally related to vnc service… Need to check that you can indeed connect with vnc client. You could try to replace the vnc’server with the tigervnc solution and give it a try (deb packages can be found in the tigervnc web site for version 16.04). check this post http://c-nergy.be/blog/?p=9962. You could try this procedure

    have you added proper command in the .xsession or /etc/xrdp/startwm.sh
    Have you checked the logs files to see what could be the problem…..

    hope this help

    Till next time
    See ya

  13. Hi,

    The Linux Mint Cinnamon edition 17.X and 18 has very similar problems. The Desktop crashes.
    This recipe works fine also on MINT if the Mate-Desktop is installed with

    sudo apt-get install mint-meta-mate.

    Thank you.

  14. @Markus,

    Thank for the info…
    We think that It might be possible to have access to the cinnamon desktop if you are using the TigerVNC software (you can see a quick demo at http://c-nergy.be/blog/?p=10028)..We still need to confirm that and provide a instructions guide…
    We are really busy at the moment, so might take a while before we publish it

    Till next time
    See ya

  15. im stuck with a black screen when i try to connect via rdp .. where isn;’t even the login screen

  16. @Tarounen,

    Black screen means generally something wrong in the startwm.sh or .xsession file. Can you check the version of xrdp you are using 0.6 or 0.9 (running xrdp -version)
    If running 0.9, changes have occured and you might need to follow another post to have it working
    If you are running 0.6, please check your logs first so we might have some hints on what’s happening (located ~/.xsession-errors)

    Waiting for your feedback…
    Till next time
    See ya

  17. Hi,

    I’ve tried xRDP 0.6 and 0.9, I have both basically “working” with MATE on separate servers. However, copy-paste is not working currently. I have seen it work, but now it’s not and I can’t figure out why. Any suggestions?

  18. This worked for me, but with an odd side effect…

    I connect to the Lubuntu 16.04 LTS system using Remote Desktop and get the “Login to xrdp” screen. On that screen I can choose a module (only sesman-Xvnc works) enter my standard username and password. At that point the connection log scrolls by and I see my desktop. But… the colors are all crazy. Any thoughts on how to fix the color?

  19. On further investigation, the crazy colors aren’t on the desktop, but in Firefox. Specifically, red and blue are swapped. Green is fine. Thoughts?

  20. Installed as described but when connecting I get the error:

    xrdp_mm_process_login_response: login failed

    I was running the set up in a root shell so no sudo commands were run. Do I need to do anything setting up as only a user? I also checked the firewall. It is disabled.

    Any help would be appreciated!

  21. @John Arnold,

    as far as I know, xrdp 0.6 package from Ubuntu repository does not offer the copy/paste feature.
    You need to have xrdp 0.9 to have it available. in 16.10, the xrdp 0.9 package is available and should support the copy/paste feature. You can also compile the xrdp 0.9 package and include the copy/paste functionatity. To have it working, you need to select the appropriate session manager….

    Note also that the feature is not fully bullet proof and sometimes the clipboard seems corrupted (and you cannot copy/paste anymore). Usually a reboot of the xrdp server tends to fix this till the next tim it happens

    Hope this help
    Till next Time

    See ya

  22. @Daenar,

    Usually, we do not encounter the issue but in really rare occasion we could see such behaviour… IN your RDP Client, can you try to change the color depth settings and see if you have better result ?
    IF this is not working, then I do not really have an idea on how to fix this

    Hope this help
    Till next time
    See ya

  23. @TJ,

    Which account are you using to login into the xrdp session ? Root or another user ?
    By Default, xrdp does not allow root login…you would need to test with a different account…..
    If you are not using root, maybe you have to check that you are part of the proper groups that grant you the right to perform the xrdp login

    Hope this help
    Till next time
    See ya

  24. @Griffon,

    Changing the color RDP Client color depth did the trick. It shows the RedBlue color swap at both 32-bit and 24-bit color depth, but at 16-bit color depth everything looks normal.

    Thank you!

  25. @Toan,

    We usually do not encounter this kind of issues. When such behavior is reported, it could be related to settings inyour RDP Client. In your RDP Client, can you try to change the color depth settings and see if you have better result ?
    IF this is not working, then I do not really have an idea on how to fix this

    Hope this help
    Till next time
    See ya

  26. Hello! I love your blog! It helps me a lot with some problems 😀 I just format my computer and install last ubuntu version from web and now i need to connect to ubuntu from a windows computer. I use xfce instead of unity and after follow your posts but now when i run the “xrdp” command i get the following error:

    running in daemon mode with no access to pid files, quitting

    i have been searching and some ppl say that i need to run:

    sudo mkdir /var/run/xrdp
    sudo chown xrdp:xrdp /var/run/xrdp

    But after that i get a strange error message in windows when i try to connect.

    Why i get “running in daemon mode..” when i try to launch xrdp process?

    I hope someone could help me

  27. @Griffon

    Thank you for the helpful description!
    But I’m running in this problem:
    abc@vps-xxx:/etc/xrdp$ setxkbmap -layout de
    Cannot open display “default display”

    It seems that I have to modify the $DISPLAY variable but what ist the right value?

    Regards,
    Jens

  28. @Jens,

    Never had that issue. are you running the setxkbmap command in the remote session or locally. if you do that from remote session, error make sense.
    If you do it while directly connected to your machine, you should be able to set your keyboard layout with no issues

    Hope this help
    Till next time
    See ya

  29. @Alfredo,

    I have no clue why this happening in your case as we never experienced such issues
    If somebody has any idea on this topic, it would be good so we can build xrdp knowledge database…

    Till next time
    See ya

  30. @Griffon

    The host is located in a Datacenter far away and I’m only able to access the host via ssh.

  31. Sorry … currently the xrdp access is possible with correct keyboard mapping
    without any modification.

    Problem solved .. 😉

  32. I just installed Ubuntu 16.04 for the first time. I went to terminal and installed xrdp, And I also installed OpenSSH too.
    Now I use Windows Remote Connection and it just works. This is on a raspberry pi3.. Putty works too..
    Works fine for me.

  33. I want to configure Hungarian keyboard layout, but when i write this command
    setxkbmap -layout hu
    I get the following error message:
    Cannot open display “default display”

    Can anyone help me?

  34. Thank you for all the work you have done. I have used xrdp and your posts for many years now.

    Suddenly (in the last few weeks), I can no longer connect to my aws ec2 instance using xrdp. After hours of debugging. it seems as though xrdp is only listening on the internal network interface and not the external one. Can you confirm this, and how do I convince xrdp to listen on both network interfaces?

    This behavior started in the last few weeks. I have not ever seen it before on 14.04 or 16.04 until now.

    Thank you for your time and best regards!

  35. @MovLab,

    Thank you for the feedback about this…. We hope that the information provided was of a good quality and useful
    Stay in touch

    Till next time
    See ya

  36. @Adam,

    are you executing the command inside the remote desktop session or when you physically logged into your Ubuntu machine ?
    If you do it from the remote session, you might end up receiving this error
    Try issuing it when logged on locally

    Hope this help
    Till next time
    see ya

  37. Hi.
    I followed you blog instructings. I can connect to ubuntu machine remotely from windows machine. but problem for me is that it randomly disconnects. Please help me.-.

  38. @Rajesh,

    Ok, That may be not enough information for us. Can you check logs files to see if we can get some info about why you are disconnected….?
    We never experienced this issue so would be difficult for us to investigate with so little info

    Till next time
    See ya

  39. Thanks for this quick guide! Got almost everything working!

    However, the steps 1 and 2, works like a charm on top of an Ubuntu 16.04 Server.

    Then, I installed virt-manager / virt-viewer (ubuntu- virt), copied an Ubuntu Server ISO, and tried to create a VM, didn’t worked, keyboard inputs doesn’t work on virt-manager / virt-viewer, when via xrdp…

    Then, I tried to install `sudo apt install ubuntu-mate-desktop`, BOOM! Broke it… The xrdp session is gray, tried step 3, nop…

    I’ll reinstall the server now, not a problem, but, I’ll try to configure the keyboard, without installing “ubuntu-mate-desktop”.

    Any idea why virt-manater / virt-viwer doesn’t work via xrdp? I also noted that setxkbmap doesn’t set anything…

    I’ll retry your instructions one more time, thanks again!

  40. @Thiago;

    Sorry for the late answer but we are busy with a lot of work lately…
    Which protocol are you using with your virt-viewer/vir-manager. I have seen somewhere that you can configure it with either SPICE protocol or VNC protocol.
    you can give a try with the vnc protocol and see if it works

    disclaimer : we never worked with virt-manager/virt-viewer in conjuction with xrdp so it’s a kind of wild guess….

    Hope this help
    Till next time

    See ya

  41. Complete linux noob here, trying to set up my raspberry pi as a headless server of sorts with remote access from my windows 10 pc.
    I installed a raspberry pi supported version of lubuntu 16.04 and then used your guide here to install mate-desktop and XRDP to access it, which worked perfectly (thank you for the guide!).
    However, I noticed that if I shutdown/reboot the linux box from within the RDP environment on windows, rather than actually shutting down it switches to an alternate environment: LXDE
    I don’t recall ever installing LXDE, but I find it actually seems to run faster and looks nicer than the mate desktop (in my opinion). How can I get it to go to this environment by default, rather than using the mate-desktop when I connect?

  42. @matt,

    You have installed on your raspberry Lubuntu 16.04, you have by default the Lubuntu desktop environment available. With Lubuntu 16.04, there is no need to have the mate-desktop install on top of the distribution. You can directly connect to the Lubuntu 1604 default desktop env. which is LXDE…

    In short, to use LXDE desktop, you need to remove mate-desktop from /etc/startwm.sh and replace it with the following line
    lxsession -s Lubuntu -e LXDE
    If you can wait 2 to 3 weeks, we are preparing a post about how to use the xrdp software with the Lubuntu edition

    Hope this help
    Till next time
    See ya

Leave a Reply