Sunday, February 7, 2010

XRDP, the best remote access software under Linux

My desktop PC is in my basement office, which is a nice place but somewhat inconvenient.  I really wanted a way to access it remotely from my laptop but had trouble finding a remote-access application that was fast enough.

Both my laptop and desktop are wireless, so there are 2 wireless "hops" between my machines and when logged into my desktop from my laptop each command (i.e. a click or keystroke) has 4 wireless hops to go through before my screen displays the result.  So speed is key. 

Remote access servers that didn't work out

I tried pretty much every remote access server I could find.  I was already familiar with VNC, and that was a perfectly viable option but my desktop has dual monitors, so there was a pretty big difference in screen resolutions and one of VNC's real weaknesses IMHO is that the client is forced to use the screen resolution of the server.  I didn't want to be scrolling around a lot so I axed that idea. 

Next I tried SSH with X forwarding enabled (using the -Y option).  That was nice and simple since all of the software and keys were already in place, but it was too slow, even with the -C option (which enables compression, effectively speeding up the rate of transfer).  FreeNX is a similar solution, and although it was somewhat faster some of the time, it didn't provide a consistently high level of performance so I had to reject both solutions.


Gnome also offers the option of logging into another machine via XDMCP.  When booting my laptop, I would stop at the login screen, hit Options, then "Remote Login via XDMCP".  In addition to stopping me from running any applications or doing anything else on my laptop while logged into my desktop remotely, this proved to be too slow also, so I canned the idea.


I was about to give up when I discovered xrdp.


XRDP

XRDP is a service that I installed on my desktop to enable it to accept RDP connections from my laptop.  Ubuntu already comes with an RDP client, tsclient, installed by default, and I've used Windows XP's Remote Desktop a lot at work so I know how well it works.  XRDP is in the Ubuntu repositories so I installed it on my desktop and now I can log into it from my laptop using the same program I use to log into my computer at work, and the speed more than adequate.  It is really great to be able to program, run virtual machines, and do many other resource-intensive operations from my laptop.

XRDP has a few quirks that I decided I could live with, but it is worth mentioning them here:
  1. It depends upon the package "tightvncserver" being installed on the server (the machine you are logging into), although it isn't configured as a dependency in the package (this was the case as of the last time I set up XRDP, which was a while ago so hopefully they have fixed this).  Install tightvncserver before you attempt to install XRDP.
  2. You may install the XRDP package and have it work just fine until you reboot the server.  This is because XRDP sometimes has difficulty figuring out whether it is running or not, so when the server is rebooting and it tries to start XRDP, XRDP thinks it is already running even though it isn't and refuses to start.  You can fix that by running this:
         sudo sesman --kill
         sudo xrdp --kill
         sudo rm /var/run/xrdp/xrdp.pid
         sudo sesman
         sudo xrdp
  3. There is no way to log into the console session.  So if I was working at my desktop and had to get up for something, I can't resume what I was doing on my laptop.  Windows XP provides the "/console" command-line switch which allows you to take over the session that is currently displayed on the machine's screen, but there is no way to do that with XRDP.  There might be a way to do it within Gnome; I'm not sure at the moment.
  4. If you do anything in the remote session that makes a sound, the sound will be played on the server's speakers, not your client's speakers.  So the first thing I hear when logging into my desktop is the sound of the Ubuntu login music being played on my desktop speakers, down the stairs and two rooms away.  This is a very minor annoyance to me but it is worth mentioning.
So now I have exactly what I set out to get: an easy-to-use remote access method that is fast and reliable.  It is really great to be able to open tsclient (you will find it on the Internet menu, it is called "Terminal Server Client") and see my desktop.  I highly recommend it!

8 comments:

  1. Using VNC requires opening of inbound TCP ports for remote access, which can compromise security. RHUB remote access is a better alternative. It doesn’t necessitate changes in firewall settings; it suffices if the remote PC is Internet-enabled. In RHUB, you have the facility to pause your work and resume it again to continue with it.

    ReplyDelete
  2. You can connect to the console session if you use x11vnc, xrdp can tie into that using the "console" option in the drop-down.

    ReplyDelete
  3. cool - thanks for the writeup!!!!! Seems to work just fine - accessing my debian server in the basement from my windows desktop in the office!

    ReplyDelete
  4. how to merge different session in xrdp?
    When opened sessions both on console and using xrpd , got two different sessions and one window opened in one session could not be seen in another session?

    ReplyDelete
  5. This all looks fine. When restarting the services, can't you just do it with a single command, like that:

    # sudo /etc/init.d/xrdp restart

    ReplyDelete
  6. If you use the same resolution and color depth on the RDP client side you can re-attach to an already opened session from a different client. In such case you will get two clients connected to the same session and both clients will have control.

    ReplyDelete
  7. Hi,
    Did you use XRDP with dual screen?
    If yes, how did you succed?

    ReplyDelete
  8. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog, I will keep visiting this blog very often.
    www.litemanager.com

    ReplyDelete