Note : this tutorial is getting really old now and Distributions have moved on a lot since Ubuntu 11.10!
Use X11RDP-o-Matic instead.
This is a followup to my original article, “Install xrdp and X11rdp – the comprehensive HOWTO for Ubuntu and Debian based systems“. In that article I used the tarball – and hence old – version of x11rdp, because at the time of writing the article, I thought the SVN – hence more up to date – version did not work.
It does in fact work, if you use the more up to date version from the SVN repository, AND you use the newer xrdp server from the Git repository. Thanks to a reader named Daniel for pointing this out.
So now you have a choice, the Old and Busted method from earlier, or the New Hotness I outline below ;)
The info here is also updated so that users of Ubuntu 11.10 (and possibly later, time will tell) can configure RDP to work properly.
The Bonus here is I’ll also add in handy tips on how to customize X11rdp so that it’ll have the rdp session as default when you connect to it, plus how to customize the logo you see when you connect! Hurrah!
2012-05-23 : Update – Instead of doing all this yourself, why not let my new utility do all the hard work for you?
2012-04-07 : Update – How to forward audio from your RDP sessions to your local client :D
2012-03-22 : Update.
Changelog;
- A recent update to the xrdp code in the git repository prevented the tutorial working – added extra step to xrdp compilation stage (Thanks go to read Daniel!)
2011-12-02 : Article updated.
Changelog:
- 1) Explicitly explain about where to perform the various commands as a normal user or as sudo/root. (Thanks go to reader Andriy!)
- 2) Greatly simplified the method by turning startwm.sh into a symbolic link to call the /etc/X11/Xsession script. (Thanks go to reader Ed!)
2011-11-18 : See Update 1 near the bottom of the article for automatically removing&restoring the background picture for the RDP session.
I’m assuming you’re running Ubuntu 11.10, which I wrote about in another article on how to customize that to give you a sensible desktop rather than that abomination they call Unity.
In fact you’d be well advised to read that through right now if you haven’t already, as I’m going to use what I did there, so that when you log into a machine running Ubuntu 11.10, you’ll be presented with a sensible desktop. In fact this article is being written and tested on the fresh 11.10 virtual machine I used in that last article.
1) Obtain X11rdp from SVN repository…
If you haven’t got it already, install subversion – you need it to obtain the SVN version of X11rdp;
sudo apt-get install subversion
Then in a terminal, in your home directory, and as your normal (non-root) user, type;
svn co svn://server1.xrdp.org/srv/svn/repos/main/x11rdp_xorg71
svn will then nab the source from the repository to your home directory.
2) Compile X11rdp…
This is much the same procedure as outlined in the old article.
You’ll need various development libraries needed to build Xorg;
sudo apt-get build-dep xserver-xorg-core
If you haven’t done so already, install automake 1.7 and 1.9 – the x11rdp compilation looks for those and whines if it can’t find ’em;
sudo apt-get install automake1.7 automake1.9
Make a directory, to which the X11rdp (and in fact Xorg) build system will place all the built binaries and files. I’ll use;
sudo mkdir /opt/X11rdp
NOTE: /opt/X11rdp will be owned by root. This is the intended result.
Next, go into the root directory of the downloaded X11rdp source tree, which will be in your home directory;
cd x11rdp_xorg71
Then start the compilation using the already configured build script, supplying it with the directory location you made above;
time sudo sh buildx.sh /opt/X11rdp
Yes that’s right, I added the “time” command in there, which will tell you how long it took to compile. ;)
Now, be prepared! The compilation takes AGES! You’re basically compiling a whole Xorg tree here – that is – the whole X Window Display System. I’m not joking – this will take a loooooong time, so, go away while it’s doing this (or read on for a bit to see what you’ll need to do next).
OK, so it took my virtual machine with 4 CPU’s running over an iSCSI system disk 18 minutes and 25 seconds to compile. Your machine may be quicker, may be slower – ain’t my fault if it takes longer :)
After compilation is complete you can (even as a normal user);
cd /opt/X11rdp/bin
ls -lh
To see if everything is there. In my case it is so we continue…
Lastly, we need to soft link the X11rdp binary to /usr/bin;
sudo ln -s /opt/X11rdp/bin/X11rdp /usr/bin/X11rdp
3) Compile xrdp from the Git repository
In the previous article I used the xrdp package from the Ubuntu/Debian package repository. This was purely out of convenience and the fact that I had always used it before.
However, both xrdp and X11rdp have been updated a lot and new features added, such that at time of writing, the current version of xrdp supplied by the distribution packages does not work with the SVN version of the X11rdp server. You’ll get an xrdp session filled with garbage, as the screenshot shows. That totally threw me off when I wrote my original article, and I wasted about 2 days trying various different distros, 32 and 64-bit, and was even considering voodoo magic to get it to work ;) … no chickens were harmed though :P
So we need to nab the xrdp source from the FreeRDP Git repository. To do that we’ll need to install git (if you don’t already have it);
sudo apt-get install git libssl-dev libpam0g-dev
Next up, we’ll need to nab the startup script from the old & busted xrdp package, for use with our new hotness compiled xrdp source, so;
sudo apt-get install xrdp
This installs the Ubuntu xrdp package, and also VNC server/clients.
Then
sudo apt-get remove xrdp
This will get rid of Mr Old and Busted, while keeping the newly generated xrdp user,group, and startup scripts, because I didn’t “–purge” them whilst removing – which is one of the useful benefits of using a Debian based system. This will come in very handy later thank you very much ;)
Next up, retrieve xrdp source from the git repository;
NOTE: Again, do this as a normal user, in your home directory!
git clone https://github.com/FreeRDP/xrdp.git xrdp.git
If you have trouble with https , then try
git clone http://github.com/FreeRDP/xrdp.git
Next, do the following steps, which will
- compile xrdp
- install it in the correct locations for Ubuntu usage
- copy and change the ownership and permissions of the RSA keys required for an encrypted RDP connection;
NOTE: Again, this starts off using your normal user account in your home directory…
2012-03-22 NOTE : Added extra step (in orange) so xrdp works correctly again.
A) Compile xrdp
cd xrdp.git
git checkout 4cd0c118c273730043cc77b749537dedc7051571
./bootstrap
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
B) Install xrdp in the correct locations for Ubuntu/Debian use;
sudo make install
C) Copy and change permissions of the generated RSA keys required for an encrypted RDP session.
NOTE: at this point, you will find yourself in a root prompt (after sudo su -)…
sudo su –
mkdir /usr/share/doc/xrdp
mv /etc/xrdp/rsakeys.ini /usr/share/doc/xrdp/
chmod 600 /usr/share/doc/xrdp/rsakeys.ini
chown xrdp:xrdp /usr/share/doc/xrdp/rsakeys.ini
Stay in the root prompt for the next step.
UPDATE: 2011-12-02; After a bit of conversation in the comments below, a better way of using the startwm.sh script has been figured out.
In the comments section below, you’ll notice I had a nice conversation with reader Ed, and eventually we came up with a better use for the startwm.sh script.
Here’s what to do. You should still be in a root prompt after the “RSA keys” step above…
A) Make a backup of startwm.sh
cd /etc/xrdpmv startwm.sh startwm.sh.BACKUP
B) Make a symbolic link called startwm.sh , to the file /etc/X11/Xsession
ln -s /etc/X11/Xsession /etc/xrdp/startwm.sh
Here’s a screenshot showing startwm.sh as now being a symbolic link to the Xsession script.
Finally, edit /etc/init.d/xrdp and add or change the following near the beginning of that init script;
PIDDIR=/var/runSESMAN_START=yes
And a screenshot of the lines highlighted.
Note: I copied the old Ubuntu “PIDDIR=/var/run/xrdp” line and kept it as a comment above.
OK, lets try starting xrdp… /etc/init.d/xrdp start
ps ax | grep rdp and… Success! Seems to be up and running.
Okay from another computer try running your RDP client and see if you can connect and log in to an RDP session…
rdesktop -a 16 -g 1240×800 192.168.1.231 (your client and ip address will almost certainly differ from mine)
And yes indeed, at least the freshly compiled xrdp is up and running.
NOTE: If you don’t want to have to be manually hunting down and killing an X11rdp process, and also having to stop and restart xrdp, don’t try logging in like I’m just about to do as a test. We need to proceed to section 4 which is next up, in order to get our sessions running properly…
Almost there!
At least now there isn’t a screen full of garbage, so the xrdp/X11rdp combination works. How to get a proper desktop though? Oh yes, we need to tell xrdp what type of session we want…
4) Telling xrdp what kind of session we want, after logging in…
UPDATE: I have re-written this section, because of the new method we did above, which has made this procedure FAR simpler!
There is a script in /etc/xrdp called startwm.sh , which is responsible for starting the window manager after you have logged in. In the step above we renamed it and turned it into a symbolic link to /etc/X11/Xsession.
In its original form, the beginning of the script as supplied read like this;
# change the order in line below to run to run whatever window manager you # want, default to kde SESSIONS="gnome-session blackbox fluxbox startxfce4 startkde xterm" start the window manager wm_start() { for WindowManager in $SESSIONS do which $WindowManager if test $? -eq 0 then echo "Starting $WindowManager" $WindowManager return 0 fi done return 0 }
This would have caused us trouble when logging into xrdp, because what it’s saying is “Here’s a default bunch of the usual window managers. Go through each one and if you find one, start it”.
Blech!
Not very flexible, and way over-complicated. Personally speaking, I’d rather it look at a file in my login directory and start whatever window manager or session I want.
Also, we can do really interesting things with a customizable .xsession script – read Update 1 at the bottom of this article for bonus hot-ness ;)
By turning startwm.sh into a symbolic link above, we can now automatically use our .xsession script in our home directory.
A) Edit or create the file .xsession in your login directory.
Please read Update 1 at the bottom of this article for additional hotness – automatically remove background for the RDP session and restore when you log out of the RDP session.
In your home directory there should be a file called .xsession
Don’t worry if there isn’t – it just means you haven’t created it yet. Anyway, after logging in via the xrdp login screen, the .xsession file basically specifies what kind of desktop session we want.
In this case, I’m going to use the Gnome 3 classic session, which if you followed my other article, should be configured by now to resemble a pretty usable old skool gnome desktop.
Simply open up a terminal and as your normal user either edit or create a file called .xsession , and enter the following;
gnome-session --session=gnome-fallback
Save the file, and if the xrdp server is not already running, start it up.
Now try to connect to an RDP session!
5) Connect via RDP!
I’ll try using the RDP client from Windows 7, mstsc.exe;
By the way, remember to select “sesman-X11rdp” module at the xrdp login screen! Log in and…
Bingo! Works nicely!
As I stated above, you can now specify exactly what session you wish to see when you log in via xrdp.
I installed Xfce, logged out of that RDP session, edited my .xsession file, commented out the gnome session and entered this instead;
#gnome-session --session=gnome-fallback xfce4-session
Then logged back in;
Freedom of choice is wonderful, isn’t it ;)
Note that now you’re using the more recently updated versions of xrdp and X11rdp, you can specify more color depths; 8,15,16,24,32 all work! (Although, I doubt using full 32-bit color over the internet is going to be fast – haven’t tried it yet).
And now for the last section of this tutorial; customization…
5) Customizing the xrdp login screen…
A) X11rdp as default on the login screen…
First of all, let’s make the sesman-X11rdp option appear by default. This is useful because A) You don’t have to keep manually selecting it every time, and B) you can just plug in your login and password details to your RDP client and you can log straight into your RDP session.
So with that in mind, have a look at the file /etc/xrdp/xrdp.ini ;
[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 [xrdp2] name=console lib=libvnc.so ip=127.0.0.1 port=5900 username=na password=ask [xrdp3] name=vnc-any lib=libvnc.so ip=ask port=ask5900 username=na password=ask [xrdp4] name=sesman-any lib=libvnc.so ip=ask port=-1 username=ask password=ask [xrdp5] name=rdp-any lib=librdp.so ip=ask port=ask3389 [xrdp6] name=freerdp-any lib=libxrdpfreerdp.so ip=ask port=ask3389 [xrdp7] name=sesman-X11rdp lib=libxup.so username=ask password=ask ip=127.0.0.1 port=-1 xserverbpp=24
Notice the section “[xrdp7]” .
It’s the one used for use with X11rdp.
Simply edit that file (you need to be root), cut & paste that to the top of the list and rename it to [xrdp1] , renumbering the others too. You should end up with something like this;
[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-X11rdp lib=libxup.so username=ask password=ask ip=127.0.0.1 port=-1 xserverbpp=24 [xrdp2] name=sesman-Xvnc lib=libvnc.so username=ask password=ask ip=127.0.0.1 port=-1 [xrdp3] name=console lib=libvnc.so ip=127.0.0.1 port=5900 username=na password=ask [xrdp4] name=vnc-any lib=libvnc.so ip=ask port=ask5900 username=na password=ask [xrdp5] name=sesman-any lib=libvnc.so ip=ask port=-1 username=ask password=ask [xrdp6] name=rdp-any lib=librdp.so ip=ask port=ask3389 [xrdp7] name=freerdp-any lib=libxrdpfreerdp.so ip=ask port=ask3389
Save the edited file, then restart xrdp with sudo /etc/init.d/xrdp restart . Then use your RDP client to connect again;
There ya go! X11rdp is now the default session type.
Press Cancel, and now enter your complete login/password details to your RDP client. You’ll be logged straight into your RDP session using the X11rdp server :)
B) Changing the Xrdp Logo on the login screen!
I’m including this as a bit of fun, but I can see where this might be useful in a corporate environment where you may wish to place your company logo on the login screen.
It’s actually remarkably simple…
Having looked at the xrdp source, I noticed that the utility loads the logo bitmaps at time of execution, so as an experiment, I spent a little bit of time to come up with a newer, fresher Xrdp logo, here’s what it looks like on the xrdp login screen – compare that to the old logo in the last screenshot above;
I think I like mine better, but I’m biased ;)
Basically all you need to do is replace the logo bitmaps with something of your choice – they have to be saved in BMP format, and it shouldn’t matter if the bitmap is larger or smaller in size compared to the original files (widthxheight in pixels) , because if I’ve read the xrdp source code correctly, it takes the dimensions of the source bitmap and allocates the memory properly for proper fixing into the resultant login screen, from the bottom right outwards. You’ll notice my logo is a bit bigger than the original Xrdp logo.
The bitmaps, after installation, are stored in the directory /usr/share/xrdp/
The two main ones to consider are xrdp24b.bmp, and xrdp256.bmp – obviously for 24-bit and 8-bit versions respectively.
Here’s the 24-bit one I made in GIMP as an example. If you like it, feel free to use this if you wish, but tell people where you got it from if they ask (and consider making a donation for all this fine work I’ve been doing for your benefit :D ).
And here’s the 8-bit version. Again same condition of use as above :)
Okay and that’s it for this one – I think I’ve covered just about all the specifics which are relevant to Ubuntu 11.10, and once again I hoped this helped!
Have fun!
So, how did this procedure work out for you? Let me know in the comments section! :D
(Oh and please rate and share this on your social links!)
UPDATE 1 : 2011-11-18 : Automatically remove your desktop background for the RDP session
This is relevant to the Gnome session only…
Edit your .xsession file to look like the following;
background=`gsettings get org.gnome.desktop.background picture-uri` gsettings set org.gnome.desktop.background picture-uri '' gnome-session --session=gnome-fallback gsettings set org.gnome.desktop.background picture-uri $background
Basically this saves your current background setting , then clears it, runs your gnome session, and after you log out of that session, restores the original background setting.
Simple ;)
X11rdp, Ubuntu 11.10, Gnome 3, xrdp customization - New Hotness! Updated!,
Hi
This guide is really Great!
But how can i change the Keyboard Layout on X11xrdp ??? (xrdp keybard work but not X11rdp)
I tried really hard and it won’t work …..
Kevin, thank you very much for a concise, thorough and easy howto on X11rdp & xrdp. I had been using xrdp w/ vnc for a long time and…well…got tired of using fluxbox for a modicum of performance across my network so I struck out to find something more efficient. And here I am. I compiled X11rdp like a champ, tried to run it with the distro xrdp and got garbage. After 20 minutes of googling I decided that I should read the rest of the howto especially the middle part I had skipped ;) Compiled and installed xrdp from your instructions and BAM, it’s working!
I have a love hate relationship with Linux, which stems from really not understanding much of it. I’m always in awe at the level of technical knowledge people like yourself display writing up these instructions, the time, the effort. I just chalk it up to you guys being developers. Maybe I’m wrong. But I can read the man pages and google until I’m blue in the face and still rely on the kindness of folks like you. So, I’m very jealous. :P My hat off to you, Sir. You have my gratitude!
Thanks Domoso!
I need to maintain 10 xubuntu computers over a wan. I can easily reach the 5 win 7 machines by setting the default rdp to 5901, 5902, in tight vnc server on the computers etc. However I can’t reach the xubuntus by altering the ports. I would like xubuntus to be 5920, 5921, etc. I tried editing the xrdp file to change the port but then I couldn’t connect at all.I was trying xxxxx.com:5920 etc with no luck.I am using remmina to reach the windows machines. I have all static ips behind the router and the port forwarding and filtering works for win 7 but not xubuntu. I think somehow I am not properly setting the alternate xrdp port. Please help. I maintain these computers for a library and am a volunteer not a pro.Thank you
very useful even after years, great tut!
Hi, version 3 works great as RDP server on Debian 7.7.
After running script everything automagically compiled just fine :)
However i can not connect to my linux using pure vnc client right now. This is strange because i thought that below xrdp manager there is a vnc server running.
Hiya, you should still have the Xvnc server installed – o-matic does not touch that package.
Try re-installing Xvnc, see how that goes.
Regards
Simply manual starting x11vnc helped :)
Hi,
Does this work for other versions of Ubuntu, namely 12.04? or is this only for 11.10?
Andrew
Andrew, hi. I wrote this article way back when 11.10 was the new kid on the block. I have no idea if it works still for 12.04 as I’ve never tried.
Regards.
Hello, is it posible to use xrdp to connect to command line only? (i use RHEL7Server)
yes.
Hi,
i have two monitors and gnome3, debian8 jessie. I do every step with success and i also install xfce4, when i try to log in, it write this:
login successful
started connecting
connection problem, giving up
some problem
:/ any idea? I have same problem to connect to gnome-session, i think this problem is becouse i have configured two monitors, i have proprietary nvidia driver installed. Any idea to solve this problem? Can i say to my sesman-X11rdp to use only one display/monitor in remote desktop session?
Thanks for help and have a nice day.
Hi Kevin,
I followed the guide to installing xrdp on Debian 8, except the parts for compiling then making the install, I used apt-get install xrdp for the installation then did the steps (3 (c) and on) then when I tested it with my Windows client, xrdp says it connects okay but then it exits out of the Remote Desktop Connection Client.
Thanks
Tom
Hi Tom,
The xrdp package as supplied by Debian does not come with the X11rdp back-end, so there’s nothing for the RDP login window to talk to after you log in – hence the need for manually compiling.
Now, this page is getting quite old now, and I doubt it’s valid for Debian 8 – notice the title mentions Ubuntu 11.10 :)
Why not try using X11RDP-o-Matic? It’s a script I wrote that downloads and compiles X11rdp for you – there’s a link to it at the top menu of my site. It gets used by the xrdp authors quite a lot so they can test xrdp whilst they develop it further.
If you choose to use o-Matic, remember and remove the Debian xrdp package you installed beforehand.
Regards
Kevin.
Hi,
I have installed X11RDP and XRDP on Ubuntu 14. First time i was able to launch xrdp. I was unable to restart xrdp service once restart the machine. I am getting the error “3350 port is already used”. I checked the port and is used by xrdp-sesman. When I check the service status of xrdp
Checking status of remote desktop protocol server xrdp [fail]
Checking of RDP Session manager sesman [fail]
Please help me resolve this issue.
Have a look at the bug report I submitted to xrdp, at : https://github.com/neutrinolabs/xrdp/issues/190
Regards
Hi,
I couldn’t find xrdp-sesman.service in this below path:
/lib/systemd/system/
Please help me how to reinstall x11rdp and xrdp completely
I presume you followed this article? As per the title it was intended for Ubuntu 11.10 and is rather old.
Why not try my X11RDP-o-Matic script instead? Link is in the menu at the top of this site.
Remember to uninstall all the xrdp stuff you did for this old tutorial, and you’ll definitely hit that xrdp/systemd thing when you use o-Matic.
Hi Kevin,
I have a naïve doubt. I have gone through xrdp.ini and found how modules are bound with its corresponding libraries. But I couldn’t understand,
1) How does xrdp create instance of x11rdp while connecting.
2) How to add another module which access libvncserver.so.
Please help me out.
Thanks in advance.
You’re actually better off asking the xrdp developers that question :)
I have a link to their mailing list in the XRDP FAQ page, link at the top of my site.
Regards
Hi
Ganesh here,
I have small issues.
I have installed Zorin OS and configured xrdp.also it is working fine with keyboard and mouse but when I access remote through thin client xrdp working fine with keyboard and mouse.Again inside linux I have taken rdp windows here keyboard not working but mouse are working fine..please help us this issue..
Thanks.
Ganesh..
Hi Ganesh,
Problems to do with xrdp itself should be reported to the xrdp devs.
Regards
THANK YOU THANK YOU THANK YOU SOOO MUCH!!!
Hi Everybody
Are there any ide inconnection with this problem..?
—————–
[20160108-11:22:43] [INFO ] scp thread on sck 7 started successfully
[20160108-11:22:43] [INFO ] ++ created session (access granted): username user1, ip 10.128.11.232:34719 – socket: 7
[20160108-11:22:43] [INFO ] starting X11rdp session…
[20160108-11:22:53] [ERROR] X server for display 10 startup timeout
[20160108-11:22:53] [INFO ] starting xrdp-sessvc – xpid=2622 – wmpid=2621
[20160108-11:22:53] [ERROR] X server for display 10 startup timeout
[20160108-11:22:53] [ERROR] another Xserver is already active on display 10
[20160108-11:22:53] [DEBUG] aborting connection…
[20160108-11:22:53] [INFO ] ++ terminated session: username user1, display :10.0, session_pid 2620, ip 10.128.11.232:34719 – socket: 7
———————————————-
This is a debian system.. Vnc session works well on same machine , but the rdp give me this log, and the session interrupt..
Please help me because the keybourd layout do not work with vnc session.. :-(
Thank you
Regards
Zoltan
I am receiving the same problem if you can find a solution please let me know!
Hello Kevin!
How are you?
In your article. Can you confirm that clients can execute (or have) sound playable. I have Linux Mint 17 server with xrd working ok but, the clients that connect by thin client, when need use hangout (google service) or skype or youtube do not have sound, only Image.
With your steps, the sounds can be play?
Whoa! This is a really old article I wrote ages ago! 0.o
I have no idea if that will work :)
The only way to find out is to try it.
Regards o7
Hi,
I am having a bit of trouble when I try to change anything in the .ini files it says “Can’t open file to write”.
Can someone help?
Sounds like you don’t have the permission to write to those files – you need to be a superuser in order to overwrite them.
Regards.