xrdp – RDP server with X

xrdp is a server on Linux that listens to incoming RDP connections, authenticates users and spawns or resumes (X) sessions as required.

I’ve covered Xvfb before: Xvfb is useful when you need an X server to run a graphical program but do not need to see the output. Xvfb does not require a physical monitor or keyboard, it runs completely in memory. I used Xvfb in conjunction with Selenium (which requires Firefox, which requires X) for regression testing.

I’ve also covered (tight)vncserver, for spawning simple X sessions. vncserver is wrapper script for Xvnc (“an X server providing VNC connectivity”). vncserver on execution will spawn an X session in memory (similar to Xvfb), and in addition will setup a VNC server allowing users to connect and view the X server from remote.

xrdp is similar to (tight)vncserver, and indeed it uses Xvnc to launch an X server. The difference is that these VNC connections only listen on the localhost. xrdp listens to RDP connections on the external interface and connects them to the new X server. Using RDP over VNC has two advantages, the first being that RDP comes with encryption out of the box. The second is that RDP is a (newer) more efficient and faster protocol.

Once a user has connected using an RDP client (Linux users can use Remmina), he or she will be prompted with sesman (a session manager) and will be required to authenticate (against the Unix system) before an X session is spawned or resumed.

xrdp is ready to go in Debian 6/Squeeze. To install it:

aptitude install xrdp

Depending on your needs xrdp can completely replace (tight)vncserver.

Tip: To resume a session, you need to connect with the same display settings (resolution and colour depth) you used to launch the original session.