Want it all done automatically for you? Click here ;)
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.
Libraries, it's all about libraries...
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
Be prepared - this bit takes AGES!
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
My $deity... it's full of Fail!
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
Install old&busted xrdp package to nab some stuff from it...
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…
Well at least it isn't a screen full of garbage... ;)
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.
Xrdp Bitmaps - find 'em here...
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!,



















dme, hi again…
I updated my x11rdp-o-matic & RDPsesconfig utilities to v2.4 which includes a fix so the utilities will run properly in a non-English system.
At the same time I tested this version on a fresh Debian 6.0.5 installation, with a Japanese locale set (to test the fix).
The utilities compiled installed and configured xrdp & x11rdp perfectly, so like I suggest, perhaps do a reinstall of your system and then download and try v2.4
Let me know how you get on!
Regards.
Hi Kevin,
I have just installed X11rdp using X11RDP-o-Matic. While I can connect via RDP, regardless of what session do I use (Gnome, Gnome classic, Unity 2d,…) I can only see my desktop wallpaper, no panels, no icons, just empty desktop. I'm on Ubuntu 11.10.
Any idea how to fix this?
Thanks for your great work
Glypto
Hi Glypto,
Not sure if you've found a solution to your problem, but try this…
echo "gnome-session –session=ubuntu-2d" > ~/.xsession
You should get a UI – i had the same problem, and it worked for me…
Good luck!
G
Dear friends.
I've installed xrdp using the automatic process and I can log in my ubuntu 12.04 machine and run some programs there, but when I try to run a java program, a .jar one. The system freezes.
Any idea?
Thanks in advance and best wishes.
Is there a way to set the default to [xrdp1]? Right now I'm using this to connect to a local VM linux box, and I have the credentials saved, so I'd like to auto select xrdp1 config without me having to hit ok at the "Login to xrdp" screen. That is, I don't want to see that login prompt at all.
Cheers!
Chris
Hola amigo ahi tu sabes si ahi forma que cuando entre a la seccion xrpd el sistema me traiga un programa especifco Ejemplo que incie y me traiga solo el Editor de texto y que otro usuario inicie y el le muestre el navegador y asi por el estilo muchas gracias
—-
Hello friend there you know if there is that when you enter the system section XRPD bring me a specifc Example program that INCIE and bring me only the Text Editor and another user logs and show you the browser and so on many thanks
—
hi mr Kevin.
first of all i want to thank you for this tutorial.
i was able to follow the instruction of the ff:
sudo apt-get install subversion
svn co svn://server1.xrdp.org/srv/svn/repos/main/x11rdp_xorg71
sudo apt-get build-dep xserver-xorg-core
sudo apt-get install automake1.7 automake1.9
sudo mkdir /opt/X11rdp
cd x11rdp_xorg71
but when i get to
time sudo sh buildx.sh /opt/X11rdp
im having an error saying
sh: Can't open buildx.sh
I'm pretty sure i follwed everything can you help me with this?
Mathew hi,
This tutorial is kind of out of date now, did you try the automatic scripts I wrote?
Regards
Kevin
I am very impressed with your tutorial.
Thank you very much. I have 2 questions:
How to redirect the printer to your desktop?
How to redirect sound to your local desktop?
Thanks in advance.
Kumar
Kumar, for audio try my writeup at : http://scarygliders.net/2012/04/06/get-audio-with-your-xrdpx11rdp-connections-lan-or-remote/
For printers, well, I haven't had the opportunity to look into that yet, but port redirection via ssh might work, I wrote about ssh at : http://scarygliders.net/2012/04/04/secure-your-systems-with-ssh-on-linux-and-putty-on-windows-part-1/
Hope this helps!
I can confirm this approach and/or your scripts works fine in ubuntu 12.10 (provided of course you install the relevant window manager). I have it running a xfce session. I use it on my home desktop monster server to serve out desktops to my more limited but more mobile comptuters. I even used it with 12.10's remote login feature on the login screen which I'll admit is a cool feature but one that I probably won't use much (there are not ubuntu workstations lying around at work : ( )
Thanks for the scripts, the deb for xrdp is still not quite right in ubuntu. So this made everything work!
As Kevin Cave says, script very cool, but having problems with national characters. I use Ubuntu 12.04.1 LTS.
I install KDE:
apr-get install kde-standard
When I install X11rdp using this script. All working good, but in Dolphin Russian folders shows bad. IMHO because used ACSII charset, but operation system gets file and folder names in UTF8. So, non-english characters, which in UTF8 describes by 2 or more symbols, show incorrectly.
One more little problem: script not check, if I start it from xrdp session, and in a center of installing process, when it removes xrdp package, it hults with session. I understand, than stupid to start this script from xrdp session, but that about foolproof :)
Hi, a friend has installed ubuntu 12.04 and uses xrdp as you. But when we connect, everyone of us gets an own session, due to different screen resolutions, do you know, how we can work around this? and the same login data always uses the same session and if another one is already in, this one gets kicked? same functionality as in windows servers.
Michael, hi
You have multiple users wanting to log into the same session?
What you’re describing is in fact the correct way xrdp works – each different user on the system should have their own session, and also, if a different person logs on as an already logged-on user, and their resolution/colour depth is also the same, then whoever is logging on will grab that session and the other person will be kicked off – that’s what’s supposed to happen :)
Regards
Hi,
I used your script and they worked on ubuntu 12.10 64 bit!
Can you explain it please a bit more in detail how this achieve this. What I want to achieve is to connect to my office pc from my home office and there it should take my current session and shows all my open windows. A small howto would be great. Thanks,
Hmm, a tutorial on HOW to use x11rdp after it’s installed?
Excellent suggestion!
Regards!
Sorry for my dumb question … I thought maybe someone has the same problem and solved it. Although you already wrote that this is feasible thats why I hoped you can explain a bit more in detail, because I tried it and it does not work
Regards
Al, hi
No no! Your question wasn't dumb at all :)
This answer I gave in another post might be relevent to your question? : http://scarygliders.net/2012/06/20/x11rdp-o-matic-and-rdpsesconfig-version-2/comment-page-2/#comment-3470
Hope that helps
Regards,
Kevin.
You weren’t joking when you said it would take a while to compile x11rdp. I have a quiet day at work today and thought I’d play with my Raspberry Pi but I only have SSH access at the moment. This has been compiling for over four hours now. I knew it’d be slower on a Pi but I thought it’d be an hour or so tops.
Lol, it’s going to take a looooong time on a Pi :)
Regards!
I am using Kubuntu 12.04 and I followed the proceedure above, but I don’t get any windows manager in the RDP window (no matter what I try in .xsession or startwm.sh ….but if opened another term session on my local system and export DISPLAY=”:10″ I am then able to start xterm or gnome-session-fallback on the RDP session. I should say now that the execute rights are on both .xsession and startwm.sh
Any ideas how I resolve the issue – its driving me mad now!
Thanks
Hello Kevin,
First of all, thanks a lot for this great tutorial, very clear & helpful.
I installed xrdp/x11rdp on debian 6.0.
I’ve now just a little question, regarding the mouse pointer.
Cursor is black&white and pixeled, is there something to do ?
Thanks,
Best regards,
[...] BOX Recent CommentsDustin on X11rdp, Ubuntu 11.10, Gnome 3, xrdp customization – New Hotness! Updated!Matthias J. on X11rdp, Ubuntu 11.10, Gnome 3, xrdp customization – New Hotness! Updated!Kevin [...]