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

23
2014-04
  • nloewen

    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?

  • Answers
  • jeffery_the_wind

    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
    

    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.

  • agc93

    I hate to be the guy who just drops a link, but I followed the guide here 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 automatic tool to install and configure it, but I haven't tried it, so be careful.

    Hope that helps you out.

  • dewi

    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 :)

  • fossfreedom

    This UbuntuForum thread looks useful - I havent tested this myself - however I've copied the solution given here to complete this answer.

    RealVNC setup

    1. Uninstallation of the default Ubuntu VNC server (Vino):

    Go to: System --> Administration --> Synaptic Package Manager Search for the "Vino" package, Mark For Removal, Apply.

    2. Installation of TightVNC and XRDP:

    While you are using Synaptic Package Manager, seacrh for "tightvnc" package (be careful, not "xtightvnc") and Mark For Installation. Likewise, search for the "xrdp" package and Mark also For Installation. Apply. PS: if you want, you may discard any other "vnc" package that you don't need!

    3. Configuration of XRDP (Optional)

    Open a terminal and type the three following commands:

     cd /etc/xrdp
     cp xrdp.ini xrdp.ini.bak 
     sudo gedit /etc/xrdp/xrdp.ini
    

    Remove Xrdp2-Xrdp6 sections, leave only the Xrdp1 section. Your xrdp.ini should look like this:

    [globals]
    bitmap_cache=yes
    bitmap_compression=yes
    port=3389
    crypt_level=low
    channel_code=1
    
    [xrdp1]
    name=RDP_To_TightVNC
    lib=libvnc.so
    username=ask
    password=ask
    ip=127.0.0.1
    port=-1
    

    4. Connecting

    Restart the system and you are ready to connect!

    To connect from another Ubuntu machine, use: Applications --> Internet --> Terminal Server Client, type the IP of your Ubuntu VNC machine, use RDPv5 or RDP, click Connect!

    To connect from a Windows-based machine, use: Start --> Run --> mstsc, type the IP of your Ubuntu VNC machine, click Connect.

    When connected, use your Ubuntu user account credentials (u/n and p/w) and remotely login to your desktop.

  • gyest

    The best explanation/solution I've found on the internet can be found at this location http://c-nergy.be/blog/?p=2879

    Give it a try

    I hope this information help

  • h0tw1r3

    I ran into this problem on a Debian machine. Used X11RDP-o-Matic to build xrdp 0.7 packages. Prior to upgrading to systemd, xrdp session reconnect worked fine.

    Looking at the process tree I could see that the sessions were no longer children of xrdp-sesman. Turned out to be a permissions issue when using systemd. Google found a patch that fixes the problem.

    How do you identify a working reconnect? Run ps axf and look at the process tree for xrdp-sesman. X11rdp, xrdp-chansrv, xrdp-sessvc should all be running as a child. If they are not, xrdp-sesman will not know how to reconnect to the session.

    Here's what it looks like when working:

    good xrdp session process


  • Related Question

    11.04 - How to use RDP protocol in Remote Desktop Viewer?
  • drgrog

    I am using a Natty Live-USB, and the Remote Desktop Viewer application (Applications -> Internet -> Remote Desktop Viewer) only shows SSH & VNC protocols.

    How can I include RDP in the list, in order to connect to existing Windows Remote Desktop sessions on Windows XP machines.

    I am aware that I can use the gnome-rdp application, or even rdesktop hostname from a terminal, but I would like to create a persistent LiveUSB that uses Remote Desktop Viewer to connect to Windows RDP (port 3389).

    I do not want to set up VNC, TeamViewer or any others, as these do not solve my problem due to the fact they need additional software on the remote hosts.


  • Related Answers
  • James Henstridge

    The versions of vinagre (the application you mention) included with all released versions of Ubuntu do not support the RDP protocol (the feature was added in 2.31.4, while Ubuntu 11.04 comes with 2.30.3).

    So there are basically three options:

    1. Wait for a new Ubuntu version with an updated version of vinagre (the next release should be sufficient).
    2. Use some other application to connect to RDP servers such as tsclient.
    3. Acquire an updated version of vinagre from some other source.
  • enzotib

    As the description says, Remote Desktop Viewer aka vinagre supports SSH and VNC.

    The standard tool used in Ubuntu for RDP is Terminal Server Client aka tsclient, so use that.

  • Capt.Nemo

    Vinagre does not support the rdp protocol. I would recommend either the default "Terminal Server Client", which offers a whole lot of options, and the remmina client, which is quite similar to vinagre, and offers RDP as well.

  • Takkat

    You may be able to get the proprietary RDP protocol running with xrdp Install xrdp, however we have not tested this here, and there are reports that this may not be easy.

    krdc Install krdc from the KDE suite also supports RDP.