Enabling Remote Desktop Access with xrdp on a Raspberry Pi

If you need to run your Raspberry Pi “headless” (without a monitor) you can connect to it via SSH. But if you need access to the desktop then one option is to use VNC, which is great if you aren’t already using Microsoft’s Remote Desktop Protocol (RDP) to connect with other servers. But if you are already using RDP then it is more convenient to enable RDP access to the Raspberry Pi and stick with just one type of client viewer.

RDP is a proprietary protocol developed by Microsoft. It is used primarily in Microsoft’s Windows Server products so that the servers can run without a monitor attached. All modern desktop versions of Windows (like Windows Vista, Windows 7 and Windows 8) all come with an RDP viewer (called Remote Desktop Connection) pre-installed. This means you won’t need to install any extra software to access the Pi’s full desktop from a Windows PC.

There are several different implementations of the RDP protocol for Linux including xrdp. The xrdp project the remote desktop protocol to provide access to a Linux desktop not a Windows desktop. The xrdp server is able to work with other open source RDP clients as well as with Microsoft’s Remote Desktop Connection program.

To install xrdp on a Raspberry Pi running Raspbian use:

xrdp will be installed as a service and will be started automatically. There is no further configuration needed to make a remote connection. On a Windows PC, launch the Remote Desktop Connection program. In the “Computer:” field, enter the IP address of your Pi. The How to Use a Static IP Address and Setup SSH on a Raspberry Pi tutorial has more information about configuring IP addresses. If you have Samba installed then you can just use the Windows networking name for your device. The default is raspberrypi. Now click connect.

xrdp-login

The xrdp login screen will appear in a new window. Here you can enter the username and password of any user on your Raspberry Pi. If you are using the default configuration then enter pi and raspberry and click OK.

xrdp-set-resolution-in-rdc

The default screen resolution isn’t set on the Raspberry Pi but rather from the client. When the Remote Desktop Connection program contacts the Pi part of the initial protocol, negotiation is to establish the screen resolution and other things like the color depth. To change the screen resolution, click on “Show Options” to reveal the advanced connection settings. Under the Display tab, use the slider to choose the size of the remote desktop. Drag the slider all the way to the right to use full screen mode.

As we have seen, the xrdp server doesn’t require configuration and works out-of-the-box, however there are a few things that can be tweaked. The xrdp.ini configuration file resides in /etc/xrdp and contains a few variables that can be set. To edit the file type:

The file is divided into different sections, each marked by a name in square brackets. In the [globals] section you can disable compression by setting the bitmap_compression variable to no. This may improve performance as it removes the need for the Pi to perform certain compression tasks which can be CPU intensive. You will likely only see a performance improvement on a very busy Pi.

The Remote Desktop Protocol has three encryption levels: low, medium and high. Low is 40 bit encryption and data is only encrypted from the client to the server. Medium is 40 bit encryption but data is encrypted in both directions. High is 128 bit encryption and like the Medium level is in both directions. To change the security level, modify the crypt_level variable.

In the [xrdp1] section, it is possible to set a default username and password which means that they don’t need to be entered into the xrdp login dialog. If you want to limit access to your Pi then don’t change these variables, though for convenience sake, you may want to change the username to your default user, however note that you can’t enter a different username if you want to login as someone else.

The xrdp server provides an easy way to access your Pi from a Windows PC and the ability to define the screen resolution when you connect is a distinct advantage, Ironically xrdp actually uses the TightVNC server to manage the X session, so if you don’t have a special preference for RDP then you could just use VNC.

9 comments

  1. In addition to above, RHUB remote support servers can also be used for remotely accessing computers. It works well.

  2. When you try this from a PC with a non-US keyboard you are likely to find some of the keys do not work correctly – xrdp seems to assume a US keyboard. ( Try the double quote and @ keys to test) There is a cure for UK keyboards at http://component-parts.blogspot.co.uk/2012/08/fixing-uk-keyboard-mapping-for-xrdp.html which works Ok. You can either copy the files from the terminal or use the RasPi file manager though yo will need to open /etc as root to allow you to copy the .ini file. For other keyboards you need to find or create the appropriate .ini file.

  3. @John the Astronomer:

    Thx a lot for your information – I found there a solution for my Rasbian problem (1x Raspian PI + 1x Banana Pi): only US keyboard available with RDP.

    Raspian Solution: copy your language file e.g. for german /etc/xrdp/km-0407.ini over km-0409.ini -> restart XRDP -> now you have the correct keyboard also with RDP

  4. Does xrdp give you a “virtual remote desktop session” or is it a live remote desktop session which means when you remote in if connected to a display you can see what is actually going on live?

  5. Installed but still cant connect

    I open remote desktop on PC, type in the pi IP address. I get login to xrdp
    Module Sesman-Xvnc
    I type in:
    pi
    password

    I get connecting to sesman ip 127.0.0.1 port 3350 ( no idea why it doesnt say Pi’s IP)
    sesman connect ok
    sending login info to sesman
    xrdp_mm_process_login_response: login failed

  6. Nice article. Seems my keyboard isn’t working at all on RD and I have it set to 102 keyboard… Not sure what is going on.

    Crysis, something is wrong with that IP address you have there, check what your home or main address is with what is my ip.com or something, then check to see if the port 3389 is open on your router. It looks like the port is wrong too (or I’m a total news and not following what you were trying from the start! Just my best guesses)

Comments are closed.

Sponsored Stories