How to reuse an existing session in XRDP?

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

Have been trying to set up an 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 for this to work?

We had this same problem, and I just found an easy solution. I originally just installed xrdp using the standard procedure:

After that, its all about your xrdp.ini file, which is in this place:

To open and edit the XRDP’s configuration file use:

by default, the first xrdp session handling script looks like this:

The critical 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 ever go back and connect to the same session. I changed mine, so it looks like this:

That’s it; I think you could get away with just changing the port=-1 to port=5912. My xrdp always re-connects to the existing session still using the same port.