Hello World,
Ubuntu 14.04 has been released on April 17th 2014 and we already released the traditional post about how to perform a fresh install. We didn’t covered the upgrade process because it’s quite easy nowadays. Basically, you will be notified that a new version is available and you will be asked if you want to upgrade to the latest version.
Some readers and some of my colleagues have been asking for a post about XRDP functionality in Ubuntu 14.04. If you follow me, you know that we have been using xrdp package in order to connect to linux machines using the built-in remote desktop client available within Windows Operating System.
You probably also know that since the introduction of Unity Desktop Interface in Ubuntu you need to tweak the configuration in order to have it working. The most annoying part while using xrdp (with Ubuntu) is the fact that you have to install an alternate desktop environment.
So, in this post, we will describe the steps needed in order to install xrdp and the xfce alternate desktop that will be used while remoting into your Ubuntu 14.04 machine.
Let’s Go !
Install XRDP Package from Ubuntu Repository
In this post, we will be installing the standard xrdp package from the Ubuntu Repository. In order to perform the installation of the xrdp package, you will login into your ubuntu 14.04 machine.
Using the Dash button, in the search box, type Terminal
Click on Picture for Better Resolution
Click on the terminal icon and the Terminal console will open
In the Terminal, type the following command
sudo apt-get install xrdp
You will be prompted for your password
Click on Picture for Better Resolution
You will be then informed about the package size. To proceed with the installation, press Y
Click on Picture for Better Resolution
Wait for the completion
When done, you need to install an alternate desktop environment. In our scenario, we are using xfce4
Installing the xfce4 Desktop environment
In the Terminal console; type the following command
sudo apt-get update
sudo apt-get install xfce4
Click on Picture for Better Resolution
You might be prompted for a password.Enter the password and press enter
You will be then informed about the package size. To proceed with the installation, press Y
Wait for the completion
Configure xrdp to use xfce desktop environment
At this stage, you have to configure your Ubuntu machine in order for xrdp to know that the xfce desktop will be used instead of the Unity or Gnome (which are not working anymore in Ubuntu). To configure this, from the terminal console, you will issue the following command
echo xfce4-session >~/.xsession
Click on Picture for Better Resolution
Restart the xrdp service by issuing the following command
sudo service xrdp restart
Test your xrdp connection
At this stage, you should have a basic xrdp working solution. When I say basic, I mean that you can indeed connect to your remote Ubuntu machine but if you disconnect your session and try to connect again, you will each time open a new session. (Read below section in this post to see how you can reconnect to the same session)
To test your xrdp solution, find the ip address of your linux machine (or use the name if you have DNS Infrastructure in place). To find the ip address, issue the command
hostname -I
Click on Picture for Better Resolution
Now go to your windows machine, start remote Desktop client and enter the ip address/name of your ubuntu machine
Click on Picture for Better Resolution
You should see then the login screen of xrdp presented to you. Note that, at this screen (and because we have not configured keyboard layout yet), the keyboard layout is set to English by default.
Click on Picture for Better Resolution
Enter your username and password and Press OK
You will see a dialog box showing the login process
Click on Picture for Better Resolution
If everything is configured correctly,you should see your xfce desktop loading and you should be able to perform you work through this desktop environment.
Click on Picture for Better Resolution
To set Keyboard layout at the xrdp Login screen, perform the following steps
As explained above, with no special configuration, the xrdp login screen keyboard layout is set to english by default. if you need to change it to another keyboard layout, you should proceed with the following actions
This is the command you should issue in order to change the keyboard layout to be used during xrdp sessions…
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
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
Reconnect to the same session throug xrdp
You have mutliple ways to reconnect to the same session through xrdp. we have explained two of them. One method is based on performing a custom installation and use the X11VNC software. This is one is working well but requires a little bit more effort. (http://c-nergy.be/blog/?p=4168)
The other one is to use the xrdp package from ubuntu repository and tweak some configuration files whil connected to the session. This solution is really a workaround and it’s not our favourite one. (see http://c-nergy.be/blog/?p=4471)
Here, we will use a third method that can be used if you use the xrdp pakcage from the ubuntu repository. This method is much better than the one provided by us some time ago. In this method, we will tweak the xrdp login screen. We will add a field in the login box where the user can specify the port to be used when remoting to the ubuntu machine.
You will first need to edit xrdp.ini file located under the /etc/xrdp. To edit the file, issue the following command
sudo gedit /etc/xrdp/xrdp.ini
You might be prompted for a password. if this is the case, provide the password and Press enter
When the file is open, locate the section [xrdp1] and replace the following line
port=-1
with the line
port=ask-1
Save the file. The file should look like this
Click on Picture for Better Resolution
When done, restart the xrdp service by issuing the following command
sudo service xrdp restart.
You are done.
When trying to access your Ubuntu machine through via the remote desktop client, you will see that the xrdp login screen has indeed an additional field called port.
Click on Picture for Better Resolution
If this is your first connection, leave the default value in the port field (i.e. -1), you will be then connecting through xrdp to your ubuntu machine using a specified port that can be seen on the login process dialog box.
Click on Picture for Better Resolution
Take a note of this port.
When you need to reconnect, you will have to specify the same port as your first connection and you should see the same screen as you left it.
Click on Picture for Better Resolution
Note : This tip has been provided to us by one of our reader (Thank you Wei 🙂 )
This is it for this post. Using only the ubuntu xrdp package, we have been able to install and configure a remote access solution. By tweaking the xrdp.ini file, we even have been able to provide a simple and easy to use solution in order to reconnect to an existing session.
However, we still have a problem with xrdp used in conjunction with Ubuntu. In order to remote into your ubuntu machine, you have no other choice than using an alternate desktop environment (in our case its xfce). I find it quite irritating that we cannot have the xrdp package working with Unity or Gnome desktop environment.
We have installed fedora distribution and installed the xrdp package. And guess what ! I can connect through xrdp to fedora and have the gnome desktop environment working. Moreover, I can disconnect and when reconnecting I will be reconnecting to the existing session I just left. And all of this with no tweak in configuration files.
I would love to see the same functionality in Ubuntu. As one of our readers mentionned, it might be time for Ubuntu users to fill in a bug report about xrdp and try to have it fixed. If more and more users complains, maybe Ubuntu team will take the request into account.
Till next Time
See ya
Awesome.. it’s working and also the session reconnect is very helpful.
Thank you.
I did install the xrdp followed by xfce desktop.
Remote desktop connection was established but the icons in the screen are not clearly visible.
Hello there,
Can you provide a screenshot ?
Till next time
See ya
I have installed xrdp as described, I can remote to it and enter my user/pwd then the remote screen goes black.
I tried both the xfce and LXDE deskptops with the same result. Both work locally just not through xrdp.
I did not configure the session reconnection.
Any ideas on what I may have don wrong? Thanks!
Hello there,
Black/grey screen means that you didn’ t create the xsession file or there is a problem with it.
Note also that the file should be created for each user on the computer.
Hope this help
Till next time
See ya
can i replace the xrdp.ini file with the 5910 port. instead of ask-1 once i get the port number?
Hello there,
You could try and you should be able to connect to the same session. This would assume that your are the only user of the.system…
This option was already mentioned by one of our reader.
Hope this help
Till next time
See ya
I was going crazy with this, as like many others (I suspect) I am trying to get a Linux VM set up for the upcoming MOOC. I landed here after trying the steps outlined on Griffons IT post unsuccessfully.
Long story short I remembered seeing somewhere about alt + f2. I had tried it and it did nothing.
This time I hit it before clicking on the annoying grey screen and Haaazah!!!! “Welcome to the first start of the panel”
I don’t know if it was just because I was holding my mouth correctly or if it was because it did the alt + f2 before clicking with the mouse but I’m in.
Hope this helps someone, it sure seems like there are a lot of people with this problem with no resolution.
Euh Hello,
I do not get the point of this comment…
If you have grey screen, it means that the .xsession file is not populated correctly or your are trying to access the machine using a Desktop interface that’s not supported by xrdp
thank anyway
till next time
See ya
This Guide helped me a lot, thank you for your efforts.
Hello there,
Thank for the visit and thank you for the positive feedback provided
Till next time
See ya
why after i connect to my linux, i try to open terminal. the problem is why what i type cannot be show? what i need to do? pls reply to my email…i need u help asap
Hello,
Nice guide, I’ve followed it to get xrdp running on Xubuntu 14.04 64bit and it works quite well in general.
I’ve ran into a pretty serious problem that I can’t seem to figure out however. I don’t need or want to keep sessions to reconnect to. A new session each time is just fine, however it looks like a session isn’t closed when I disconnect, as such memory usage keeps going up and up.
I assumed logging out of the session itself would fix it and while this does free some memory it still isn’t closed entirely (when I log out I’m still left with the wallpaper and the connection isn’t closed).
I’ve done some digging and found about the KillDisconnected option in sesman.ini, however this is apparently ignored and doesn’t do anything.
Right now the only ways I can “clean up” are to reboot the machine or to start killing Xvnc processes and neither of these are very nice solutions, especially since I don’t know how to figure out which Xvnc processes are being used and which are leftovers (I’m not the only one connecting, so I can’t just kill possibly active sessions). I’d even accept some workaround like having a cronjob periodically clean up old, unused sessions if I knew a way to figure out which sessions were old.
Any ideas on how to fix this would be appreciated.
Thanks!
Hello there,
I’m assuming that you have installed xfce as desktop interface to be used with xrdp. This is a known issue. You have three ways to overcome this situation
Option 1 : The other workaround is to use the XTERM application instead of the Terminal
Option 2 : For a not working Terminal under xfce (XRDP), you can get it to work by: Settings -> Appearance -> Style, select style to, for example, Radiance.
Option 3 : Use another Desktop Env for your xrdp. check the following links….
http://c-nergy.be/blog/?p=5382
http://c-nergy.be/blog/?p=5357
Hello,
The first option would be to configure your system to reconnect to the same session. So you minimize the session open to your server and minimize ram consumption…..
The other option would be to edit the sesman.ini file and add a additonal line under the [Xvnc] section. if you open your sesman.ini, you should see something like
(…)
[Xvnc]
param1=-bs
param2=-ac
param3=-nolisten
param4=tcp
(….)
Append the following line at the end of [Xvnc] section….(we have used param5 but you need to adapt based on your config -could be param7 or param9)
param5=-once
this should force the xvnc to kill your session when disconnecting….
I have not tested this option…. a friend of mine mentionned it to me…..
if this is working, please let us know, so we can share and spread the information
hope this help
till next time
see ya
Hallo,
the first xrdp connect is OK, but the reconnect with the port from the first time hangs.
Example: the port is 3350 in the first connetion log.
at second connect the log writes:
-started connecting
-connecting to 127.0.0.1 3350
-tcp connected
and nothing else – the session hangs
is the port number wrong, or what else gone wrong?
thx andi
Thanks for the reply!
I’ve tried adding -once and sadly it doesn’t work. I have checked and the -once parameter is indeed being passed correctly to Xvnc, but it seems to be ignored as it still doesn’t shut down. Too bad, this would’ve been exactly what I wanted.
Meanwhile I set up a hacky workaround, I’ve put my beginner scripting skills to use and wrote a script that kills Xvnc processes that have no established connections. I’ve then set cron to run this script every 5 minutes. So now in at most 5 minutes after somebody disconnects the session will be cleaned up.
It’s not ideal by far but at least this way I don’t have to constantly keep an eye on memory usage. Considering this machine will have ~3 users at most this should be fine for me.
I’ve uploaded the script here, in case anyone finds it useful:
http://pastebin.com/xxrg9CVS
Hello Red,
Thank for sharing your script…..
At the moment, I do not have much time to blog (working on heavy project) but I’ll definitely come back to this topic and see what’s possible to do .
Take Care
Till Next time
See ya
Hello Andipc,
Please read carefully the post.
If you trying to reconnect to the session using the port 3350 -> This is wrong
As described in the post, you should use a port in the range 5910 and above…. Check the post back and there should be a picture that shows where to find the port that you have to use
The port 3350 is used to connect to the Sesman session… The first time you connect you might see in the first line the port 3350 mentioned but then if you read a little bit below, you should see the real port used for the connection (there is a screenshot on this post http://c-nergy.be/blog/?p=4471)….
Hope that this help
Till next time
See ya
I just wanted to say after SCOURING the web for a fix, this was the only one that worked! Thanks so much!
Hello There;
Good to hear that you have found a solution on our Blog 🙂
thank your for the visit and confirming that this tip is still working…..
Till next time
See ya
Thank you so much for the detailed explanation.
I still have a question. In fact, I can connect the xrdp server. However, after I type in all my user account, I got a screen like the link shown
https://dl.dropboxusercontent.com/u/2165450/problem.png
I think that I have connected to the xrdp server. However, only the option “sesman-Xvnc” works but still can not establish the real connection.
Does anyone have some idea about this?
Yu-Ting Liin
hello there,
if you see the gray desktop, this might be because you have not installed alternate desktop (xfce,lxde or mate) or you didn’t populate the .xsession file correctly (typo or type in the file name) or that you have populated the .xsession file for one user but you are login into xrdp with another user. I would also try to restart the computer (to restart xrdp) adn to login on your machine locally specifying the alternate desktop to ensure that you have configured everything correctly
check already this and see if this fix you issue + you should check the xrdp log files (sesman.log,…) you might have more information about your issue
hope this help
Till next time
See ya
Hey, thanks for the message.
I found that my problem is about the configuration ~/.xsession file. I only change for account, root but not for my login account. Therefore, it does not work. I aslo test for the function of reconnection. It works well.
About the other connected options like console, vnc-any, Does Griffon know what the difference is?
Thanks a lot,
Just what I needed. This is perfect. thank you!!!!!!!!!
Hello Yuting,
The option vnc-any simply allows you to use the xrdp interface to connect to a “real” vnc server. If you are physically logged into your ubuntu machine (no remote desktop connection) and try to access your server, you will initiate a “real” vnc session
Hope this help
Till next time
See ya
You saved the day! I came across a few different posts prior to this one that were unable to solve the problem. Yours was easy to follow and fixed the issue. Thank you!
Excellent Guide… Thanks…
After following the guide I’ve now got my Ubuntu 14.04 64bit server accessible via RDP from a windows machine, One problem remains – when I try to browse the file system using file manager no icons are shown, only the labels – is there a way to fix this?
Hello there,
I’m sorry, I will have no time to check into this issue right now….
As a quick workaround, you can try to install another Desktop interface (To Install MATE, check http://c-nergy.be/blog/?p=5382) and see if this fix your issue.
you can also try to install LXDE instead of XFCE and see if this is working
Till next time
See ya
Just did this again on Linux Mint and I’m running into the problem of when I change the .xsession it changes it for my entire log-in and not just for the remote client so if I change it to XFCE, then it makes me log-in that way.
You can delete my prior comment if you like, I fixed it, my log-in was using the Xclient script instead of using an interface to log-in.
Great information. This post and discussion has been a tremendous help for me.
A quick note for those wishing to figure out what sessions are active and what ports they are using, some detective work using “ps” and “netstat” can solve the problem.
For example:
ps -ef | grep vnc
Will list XVnc processes running on the system.
netstat -autp | grep vnc
Will list listening and established VNC Xvnc connections and their associated ports. (ie., localhost:5910)
Hello Robert,
Thank for sharing information about that…
That might be useful to some people
Thanks for the visit
Till next time
See ya
This doesn’t work on Ubuntu 14.04 64-bit.
>Step 2 : you issue the command setxkbmap -layout to define which >keyboard map/layout to use
The command setxkbmap gives the following error:
XKB extension not present on :13:0
I’ve installed all packages that looks like they could be relevant, to no avail.
Hello there,
This should be working if you use the xrdp package from ubuntu repository. This is a standard command.
You have to issue the command while login locally into the ubuntu machine. You cannot issue the command while connected through xrdp
Hope this help
Best Regards
Griffon
This solved my problem! Thanks.
This gives me an excuse to learn xfce.
Solved my problem quickly!
Gives me an excuse to learn xfce to.
An alternative to XRDP is x2go. Clients support on Windows is generally pretty good… but Mac OS X is somewhat broken at the moment. From Linux it works great.
Hello,
We know x2Go solution as well… The drawback is that you have to install the client on your windows system. using xrdp and some tweaks on the xrdp server, you can connect using builtin tools available on linux and on Windows Machines. However, we will have a look at x2Go in the future because there is an option that allows to connect to Unity desktop interface….
This is something that some people might be interested in
Thank for the visit
Till next time
See ya
Great write up. Works perfectly! Thanks a lot!
Thank you Will;
Nice to see that the post is useful and still working !
Till next time
See ya
Finally!!!..Works great. thanks for your knowledge.
Cool ! It’s still working
Thanks for the visit…
Till next time
See ya
Great write up and it worked as explained BUT ….. I would prefer to get UNITY desktop working through RDP.
I have hunted but cannot find anything that works
any ideas?
Lawrence
Hello Lawrence,
At the moment, XRDP is not working with Unity. XRDP Package should be modified to support the desktop but neither xrdp community nor Ubuntu are working on that….
Stay tune if you still use xrdp and access your unity desktop. We are working on a post where we describe how to connect to the Unity desktop – But this will be a dirty workaround… So do not get over excited about that
Till next time
See ya
Hello, I am trying to connect, it is working but I have only a grey page without anything. Do you know the problem ?
You need to follow this tuto if you are in the same situation then me.
http://www.tweaking4all.com/software/linux-software/use-xrdp-remote-access-ubuntu-14-04
Now it is working
Hello Vincent,
Any problem with grey screen is either an error with the alternate desktop or a problem with xsession file not populated correctly or missing. Another common mistake is that you are remote login with a user account for which you do not have created a xsession file and thus you have indeed a grey screen.
If you have followed the post instructions, it should be working. It has worked for me and it has worked for many other people (check the comment section)
The link you have provided perform the steps as we do. The only exception is the startxfce in the startwm.sh. This change is not needed if you have the xsession file and xfce installed correctly on your system. If you comment this line, you should still be able to connect to your xrdp server….
Thank for the visit and the comment.
Till next time
See ya
OK i must be retarded because this didnt work for me. I got an error message. I added a link to the pic below.
http://i.imgur.com/vnHg7zl.png
if anyone has any suggestions on how to fix this it would be greatly appreciated.