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. @Nathaniel

    your commands seems correct
    sudo apt-get remove mate-desktop-environment (or sudo apt-get remove mate-*)
    you can try the following to remove packages and dependencies
    sudo apt-get remove –auto-remove mate-desktop-environment
    Use the following command to cleanup data and config file as well
    sudo apt-get remove –auto-remove mate-desktop-environment

    restart the machine and this should be good

    Hope this help
    Till next time
    See ya

  2. Hello,

    In step 3, you are using quotes that do not work when copied and pasted into a uBuntu terminal session.
    In other words.,this is what you have for step three:
    sudo sed -i.bak ‘/fi/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh

    but this is what is should be, please notice the different quotes:
    sudo sed -i.bak ‘/fi/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh

    Nice blog!

  3. @Reuben,

    Thank for the feedback. The formatting used by wordpress changes the original character set. If you would have read the comments, you would have seen that we already mentioned that copy/paste would give you an error and that the quotes would give an issue..

    We will look into a possible solution to either implement proper characters or to at least put a warning messages about the format text used and the possible errors to get

    Till next time
    See ya

  4. This worked flawlessly and took me a total of 8 minutes to complete. Thanks for writing the article!!

  5. Thanks for this!

    It took all of five minutes to convince my Ubuntu 16.04 installation(s) to accept RDP connections, thanks to your instructions.

  6. @Tara,

    In theory no, you are simply adding an additional desktop environment. I would highly recommend you to test the configuration on a virtual machine so you can assess if you Unity Desktop will be changed or not

    Hope this help
    Till next time
    See ya

  7. Great step-by-step guide, thanks!

    Unfortunately, everything worked great but what I needed the most: QtCreator! I tried also the xfce4 desktop with no luck 🙁 Do you know any solution for these?

    Qt would start (and stay as an active process) but it won’t show up in the desktop.

  8. @Alejandro,

    Sorry for the delay but I was working and travelling lately….
    Never had to start QtCreator within the XRDP so not sure if this is an issue with xrdp… in general, if we open any other apps, they are starting and visible….

    We will see if we have some time to test and see what could be the problem

    till next time
    See ya

  9. @Griffon

    I have read and have found a lot of use out of your posts on XRDP.

    I’m currently in progress of writing guides for RDP with XRDP and Desktop Environments of choice on Azure VM’s.

    However I am stuck at the XRDP configuration for KDE on Ubuntu 16.04. As you mentioned before the echo xsession doesn’t work anymore. The command you use in this guide solves the problem for MATE, but I haven’t found how to fix it for KDE, LXTE and others.

    Could you update the guides for Ubuntu 16.04 or post the commands needed for these environments here?

    Thank you a lot!

    Lamapudding

  10. Ive installed the remote desktop but i can only login with my root user. Any ideas so i can login with my non root user?

  11. @fr0do,
    be more specific in your question. Describe with enough details your issue

    When you say other users cannot login, you mean

    xrdp login box appears but they have a grey screen when connected to the session
    password provided in xrdp login is not accepted

    Have other created local users on your Ubuntu machine ? have you configured the startwm.sh file accordingly ? Do you receive an error while trying to login ?

    Hope this help
    Till next time
    See ya

  12. @siebstimmermans,

    KDE in ubuntu 16.04 is a newer version of the software and does not seems compatible anymore with xrdp… We have already mentioned this issues in one post and in comments sections

    as we do not use kde extensively, we have not yet investigated for any possible workaround…

    Till next time
    See ya

  13. It seems that it is impossible to logout from MATE over xrdp. Is it so? Any workaround?

    Thanks

  14. @Mada,

    have you read the post fully ?
    There is a note section that redirect you to instruction on how to have other DE working with XRDP. Other DE are XFCE, LXDE, LXQT. The KDE DE used in Ubuntu 16.04 is not working anymore with the XRDP…
    CiNAMON DE is not working and GNOME 3 is not working either…..

    Till next time
    See ya

  15. @Mada,

    use the command line to logout if the logout option is not working for you
    google for the most appropriate command but should be similar to mate-session-save –logout-dialog

    Hope this help
    Till next time
    See ya

  16. Hi sorry, newbe!

    Got it working with xfce ! Great. Looks nicer that MATE.

    Thank you!

    Will try the logout too…

  17. I installed the Mate-Desktop and xRDP, I was under the impression that I would be able to utilize two monitors on the remote MS Terminal Server environment. I have been unable to achieve this so far. When I launch Remmina it looks the same with the same options as before the Mate and xRDP install. However I am working from the Mate environment so that part seemed to work fine and I have the two monitors working there. Now I need them to work on the remote end as well. What can I do to make this happen?

  18. @N Davis,
    Do not really understand your question…
    Do you have two physical monitors connected and you want to use xrdp with multi monitor support ?
    or are you talking about the remote session (you have two different sessions local session and remote session..)

    You are talking about remmina to connect to MS Terminal Server…. xRDP is the Linux Terminal Server alternative…
    So, if you are trying to connect from your linux to a windows Terminal server, you do not need xRDP installation…. Do not know if remmina come with multi monitor support, but I think that xfreerdp has a switch for multi monitor support

    Hope this help
    Till next time

  19. I have installed and configured the xrdp as per the directions but when I login it is showing “Could not acquire a session bus”. when I close it and get in inside the remote machine and try to type a command in the terminal it is showing me command not found.

  20. Fantastic guide. Just none of this is working with Mint 18 (worked on 17.3); xfce desktop no less. I can’t get past that grey screen on Mint 18..

  21. Hello
    They worked but I can’t open firefox.
    Is there any issue about taht?

    Thanks for your post

  22. @Drew,

    we are not working with Mint distribution. SO i have no clue why this might not working…you should have a look at the different logs files (~/.xsession-error file) and check what could be the problem
    Have you tried the following approach instead of using the standard xrdp package (see http://c-nergy.be/blog/?p=8969)

    sorry for not providing more info about that…if time permit, will give it a try on Mint

    Till next time
    See ya

  23. @Lee,

    you are the second person mentioning that firefox is not working.. We have test the process on fresh ubuntu install and via xrdp we were able to start the firefox…
    At the moment, no clue why this is happening….Is this for all applications or only firefox…do we have any logs that could point us to a possible solution
    will try to reproduce your error but as mention before, we have not encountered such issue….

    Till next time
    See ya

  24. @Mateen,

    Would it be possible to have some screenshots of the error..? Can you upload them somewhere…..
    It seems that xrdp cannot connect properly to the remote session

    Try to update the /etc/xrdp/startwm.sh and include the following lines
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    Before the mate-session line

    PS : I have not clue if this will fix the issue but it worth give it a try

    Please forward feedback if working
    Till next time
    See ya

  25. Hi!

    I’m very, very, very new at this and im trying to set up a VM using ubuntu 16.04 but all i have is mad googling skills (which led me here!). When trying to do step 3, all i get is “sed: no imput files” and i have no idea about what to do! Can you help me?

  26. @Martin,

    never got this error. This error means that you didn’t specify the name of the file to be modified…
    I don’t want to look for the reasons behind the error… So, simplest for you. from a TErminal, type sudo gedit /etc/xrdp/startww.sh to edit the file where to add the line mate-session just after the line fi

    Till next time
    See ya

  27. In response to an earlier post, I am running 16.04 and have xrdp working with xfce4 and xfce4-goodies. I found instructions for doing this here:

    https://aws.amazon.com/premiumsupport/knowledge-center/connect-to-linux-desktop-from-windows/

    Griffon, I want to thank you for this blog, even though I followed the instructions in the link above rather than following the ones in your blog. Your single line: “xrdp and Unity desktop (or Gnome 3) are not working well together” explained why I had a whole day of difficulty. As you’ll see from the link, the instructions I followed put a line in the .xsession file rather than modifying the /etc/xrdp/startwm.sh script, but this seems to work just fine.

    Again, thank you very much for this blog.

  28. Hi,
    xrdp doesn’t work. I’ve installed it, tried to start under xfce (you said this is supported, but doesn’t matter) at first, and nothing happened. Interminal I’ve got an error: xrdp is running, delete xrdp.pid and try again. Searched this xrdp.pid and removed. Installed mate desktop for recommendation and started that session.
    prompt > xrdp
    running in daemon mode with no access to pid files, quitting
    The result is the same after purge and install again.
    How can I solve this probleme? Please do not link bugreport. I’m over that.

  29. @C0bol

    You do not provide any useful information in your comment….have you checked the logs on your machine to see what’s happening…Provide more info..what’s not working, can you see the xrdp login box, can you login, do you have a grey screen when login,….

    Till next time
    See ya

  30. Is there any way to connect via RDP to a session that I started locally. By saying locally I mean the following scenario: 1. turn my PC on. 2. I open Firefox and go to e.g. cnn.com. 3. I let the PC keep running and I go to work 4. From my laptop at work I start an xrdp client and after having connected to my PC at home I want to see the opened Firefox with the cnn.com !!! So far I was only able to reuse the same remote session but it is a completely another case. Any help appreciated

  31. @Philip Stanton

    Good to see that the post can be useful to a lot of people.. Thank you for your feedback and share your experience with our community.If you wish to use Unity Desktop through XRDP Session, have a look at the following post as well http://c-nergy.be/blog/?p=9962

    Till next time
    See ya

  32. @Tomek,

    As far as I know, It’s not possible to connect to the console session through xrdp. So if you are using the xrdp solution, you will always open a session different than the console session…. In one of our previous posts, we offered kind of a dirty workaround (see http://c-nergy.be/blog/?p=5956 . You will basically use XRDP software to perform a vnc connection to the console.

    If you setup your system to be able to connect to Unity Desktop through xRDP (see http://c-nergy.be/blog/?p=9962), you would then be running tigervnc solution..
    Within your xRDP session, you can in theory open a vnc console session from your remote session and access your console session (nested remote desktop)

    Hope this help
    Till next time

    See ya

  33. Hi, thanks for this nice guide, it works perfect.
    Reconnecting to the same active session works fine too, but if the server has been rebooted, a new session will be created. All my changes to the “look & feel” are gone. Is there a way to safe the current session settings?

  34. @Mr Fish,

    As a first guess, I would say you need to make customisation in the Desktop Environment while connected locally to your machine.
    On your system, clogin locally using the appropriate Desktop Environment you need, customize it there and when completed logout.
    Then connect back via XRDP and see if you changes are visible during your remote session

    By the way, if you are not aware, you can now connect to Unity Desktop through XRDP.(more info at http://c-nergy.be/blog/?p=9962

  35. Im a novice in the linux world, I followed all the steps but the performance is very slow, I understand thats because the RDP really connects to a VNC session. then I tried another procedure thats supposed to be more efficient, but didn’t work because I didn’t install the VNC server, I installed instead a dummy monitor to make it work, but the performance is exactly the same.

    are there any other options for RDP protocol? at work I can use only it.

    thanks.

  36. It seems that I needed to post my previous comment just to realize the issue its really the VM location. its just too far from my home, and the internet is cap at work.
    It runs much faster if I connect to another server inside the company network that its internet is not cap, then connect that server to the Linux VM. its much faster now, and also I think that since im not using VNC im really connecting to the Ubuntu console session. what I did was the follow:
    Installed XRDP from its repository.
    Compiled enabling RFX and Jpeg although i think is not being used.
    Compiled and install Xorg and Xorg dummy monitor.
    Setup Mate session.
    Connect using lib=libxup.so in xrdp.ini

    unfortunately I cant compare this process to the one that use VNC now, I actually dont know if im actually connecting to vnc through rdp. but its very fast now.

    thanks.

Leave a Reply