I installed xrdp on my ubuntu 14.04 machine using the below commands. I can now remote desktop from my windows machine easily into my ubuntu machine.

However, what I notice is when I close the remote desktop connection and login again with same credentials, it would start a fresh new session. I was expecting to see the screen where I left. Is there anything specific I need to do to preserve the session?

sudo apt-get install xrdp
sudo apt-get update
sudo apt-get install xfce4
echo xfce4-session >~/.xsession
sudo service xrdp restart

There is a post at http://c-nergy.be/blog/?p=5305 that gives a couple of options e.g.

edit /etc/xrdp/xrdp.ini

sudo gedit /etc/xrdp/xrdp.ini

Locate the section [xrdp1]

Replace the following line:




Save the file.

Restart xrdp:

sudo service xrdp restart.

When you login enter a port number e.g. 1234 and then just use the same port number each time.

  • 2
    I think this answer is either outdated or just wrong. On your first connect (when no session exists yet) you need to leave the -1 in there, you then need to take note of the port used (something in the 5910-59XX range), and use that instead of the -1 in the subsequent connections – nhed Sep 16 '15 at 13:41
  • @nhed What is the significance of the 5910 and 59XX port range? Can I not use 55555 or bigger or smaller? Also where do you find the port that ended up being used? I am using Windows Remote Desktop to connect to xrdp. – CMCDragonkai Dec 18 '16 at 5:54
  • If you missed the initial connection log, is there a separate way to get the port being used? – CMCDragonkai Dec 18 '16 at 6:18
  • sorry - Its been a year so I don't remember the context - I don't think this ever worked right for me. I can tell you that ports 5900-59xx are typically used for VNC – nhed Dec 21 '16 at 8:45

After upgrading my 12.04 server, it appears that Ubuntu 14.04 works much differently that 12.04 in regards to xrdp. In 12.04, an existing session was always reconnected to before attempting to start a new one. This is not the case with 14.04 as it appears to start a new Xvnc process for every connection when 'port=-1' in xrdp.ini. It's possible recompiling the xrdp package may return the functionality but I would surmise this is more likely due to systemd which does not allow user background processes after logout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.