How to locally resume a session that has been started remotely using xrdp?

Solution 1:

xrdp runs xvnc over rdp and does so very well. The default configuration launches a new xvnc session on each connection, starting at port 5910. To get it to reconnect to an existing session, edit /etc/xrdp/xrdp.ini thusly:

[xrdp1]
name=sesman-Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=ask5910

This way it asks for the port with a default of 5910. If no vnc session exists on 5910 then a 5910 connection attempt will fail. In that case try again, but set the port to -1 to force the creation of a new session, typically on 5910.

Solution 2:

One option if you have ssh connection to the other machine is to find the litening ports for vnc as explained at the end of this post

You could login a ssh session and find out the number by

netstat -tulpn | grep vnc

and you will get something like the following

tcp   0    0 127.0.0.1:5910     0.0.0.0:*     LISTEN      5365/Xvnc

and then you know 5910 was the port you connected to.