Ubuntu: How do I set up xrdp session that reuses an existing session?
Channel: Roel Van de Paar
Date: 2019-06-17

Ubuntu: How do I set up xrdp session that reuses an existing session?


The Question: I have been trying to set up a RDP terminal server on precise using xrdp and
have been having significant trouble getting a working configuration. When a
user logs on, I need it to connect to that users existing session if it exists,
otherwise starting a new session, and any started session must start LXDE. What
changes to the default configuration do I need to make in order for this to
work?

Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):

== This solution helped 7 people ==
I hate to be the guy who just drops a link, but I followed the guide http://
scarygliders.net/2011/11/17/x11rdp-ubuntu-11-10-gnome-3-xrdp-customization-new-
hotness/ and it worked really well. I can now log into an RDP session from
Linux and Windows hosts and reconnects me to my old session if I've logged in
before. This is the best guide to the install I've found. Unfortunately, the
standard package install causes a lot more problems than doing it from source.
The author of that link has also made an http://scarygliders.net/2012/05/23/
the-scarygliders-x11rdp-o-matic-and-rdpsesconfig-hotness-upon-hotness/ to
install and configure it, but I haven't tried it, so be careful.
Hope that helps you out.

== This solution helped 2 people ==
on the log in screen with the xrdp box when you first connect to the remote
desktop there should be a drop down box, from here choose "vnc-any" then input
the ip address of the computer and the password but leave the port at what it
is, this should help :)

== This solution helped 43 people ==
I had this same problem, and I just found an easy solution. I originally just
installed xrdp using the standard proceedure:
apt-get install xrdp
After that, its all about your xrdp.ini file, which is located here:
/etc/xrdp/xrdp.ini
To open and edit the xrdp's configuration file use:
sudo nano /etc/xrdp/xrdp.ini
by default the first xrdp session handling script looks like this:
[xrdp1]
name=sesman-vnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=-1
The important line is port=-1, this makes xrdp always look for a free port to
connect. If you set a fixed port here, the xrdp will always go back and connect
to the same session. I changed mine so it looks like this:
[xrdp1]
name=customsessionname
lib=libvnc.so
username=myusername
password=ask
ip=127.0.0.1
port=5912
Thats it, I think you could get away with just changing the port=-1 to
port=5912. My xrdp always re-connects to existing session always using the same
port.

With thanks & praise to God! With thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free-music | Images: https://stocksnap.io/license & others | With thanks to user YH Wu (https://askubuntu.com/users/339821), user QuestionReality (https://askubuntu.com/users/292758), user nloewen (https://askubuntu.com/users/61393), user n611x007 (https://askubuntu.com/users/100478), user Jorge Castro (https://askubuntu.com/users/235), user jeffery_the_wind (https://askubuntu.com/users/58854), user Dewi Jones (https://askubuntu.com/users/148411), user agc93 (https://askubuntu.com/users/53518), and the Stack Exchange Network (http://stackoverflow.com/questions/133343). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.