Getting x11rdp working on Debian 8, Jessie, with the help of X11RDP-o-Matic

Note: there is currently a bug that stops X11RDP installation on Debian 8.7:

I recently posted about using RDP to connect to Debian 8 clients via xrdp and, things were going well until I tried to redirect session sound and then started looking into the default xrdp configuration; it turns out that the default xrdp package leveraged vnc… yes, vnc. Surely there has to be a more effective way…?

This got my looking at x11rdp, which can provide native RDP connectivity with the following benefits:

  • Redirected sound
  • Redirected clipboard (copy paste between remote host and client)
  • Better visuals / performance (YMMV)
  • (to follow) use of Remote-FX for improved video playback etc.

I came across Kevin Cave’s X11RDP-o-Matic, however this did not support Debian 8, but it gave me 90% of what I needed.

After a while of trying to figure out what was causing the script to fail on Debian 8, I submitted a pull request to modify the “required packages” associated with the “–withjpeg” compile flag. Until this is committed, in some form, I have created a modified copy of the main script here.

All of the below is performed and tested on a vanilla Debian 8.6 machine , via a remote SSH console – your mileage may vary should your configuration not match.

Pre-flight checks / pre-requisites

You’ll need to ensure you’re running KDE or XFCE. This will not work with GNOME.

I’ve used sudo throughout this post, so install and add your non root user to the group (alternatively get all of my code snips and remove sudo!) – git is also used from the offset, so I have included this here.

apt-get install -y sudo git
adduser <user account> sudo

Log off and login again via SSH to refresh your groups, allowing sudo to work.

Now update your Debian install prior to continuing to build and install x11rdp.

apt-get update
apt-get dist-upgrade -y

Download and Execute X11RDP-o-Matic

# Download X11RDP-o-Matic 
git clone
cd X11RDP-o-Matic

# Download modified and chmod +x
chmod +x

# Build and install x11rdp and xrdp packages - this will take a while!
sudo ./ --interactive --withjpeg --withsimplesound --withpulse --withkerberos --withpamuserpass --withfreerdp

Fix anomalous “.service” files 

Comment out “EnvironmentFile” line and changing the PIDFile location for:

  • /lib/systemd/system/xrdp.service
  • /lib/systemd/system/xrdp-sesman.service
sudo sed -i 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp-sesman.service

sudo sed -i 's/PIDFile=\/var\/run\/\/run\/' /lib/systemd/system/xrdp-sesman.service

sudo sed -i 's/EnvironmentFile/#EnvironmentFile/g' /lib/systemd/system/xrdp.service

sudo sed -i 's/PIDFile=\/var\/run\/\/run\/' /lib/systemd/system/xrdp.service

Now, reload service definitions and enable / start services.

sudo systemctl daemon-reload
sudo systemctl enable xrdp-sesman
sudo systemctl enable xrdp
sudo systemctl start xrdp-sesman
sudo systemctl start xrdp

Generate xrdp rsakeys.ini

Now, generate xrdp rsakeys.ini, without this you’ll be unable to connect and get errors in event /var/log/xrdp-sesman.log  as below:

  • [ERROR] Listening socket is in wrong state we terminate listener
  • XRDP cannot read file: /etc/xrdp/rsakeys.ini (check permissions)
sudo xrdp-keygen xrdp auto 2048 

Build Debian 8 pulseaudio xrdp sink modules

You should download the version of pulseaudio nearest to that in your disto – check using:

pulseaudio --version

Now, download the pulseaudio source and configure – note you do not have to make / make install pulseaudio.

Be sure to change the version number (5.0, in bold, below) to match that from the command above.

sudo apt-get install -y libjson0-dev libsndfile1-dev libspeex-dev libspeexdsp-dev libcap-dev

cd /tmp
tar -zxvf pulseaudio-5.0.tar.gz
cd /tmp/pulseaudio-5.0

Now, build the modules and copy them to /usr/lib/pulse-5.0/modules and, finally for the xrdp sink modules, call them to /etc/pulse/

Again, watch the version numbers / paths as you may need to change these for your build.

cd ~/X11RDP-o-Matic/work/xrdp/sesman/chansrv/pulse/

# Change the patch here to match your path
sudo sed -i 's/PULSE_DIR = \/home\/lk\/pulseaudio-1.1/PULSE_DIR = \/tmp\/pulseaudio-5.0/g' Makefile

sudo make
sudo cp *.so /usr/lib/pulse-5.0/modules/

cd ~
sudo cp /etc/pulse/ ~
sudo sed -i -e '$' /etc/pulse/
sudo sed -i -e '$' /etc/pulse/

Build .xsession Files

We now need to call the script contained within the X11RDP-o-Matic package. This will build the .xsession file for all users.

I’d stress that feedback (from comments below) and my own experience shows that Gnome will not work via x11rdp, or xrdp for that matter. KDE and XFCE both work.

cd ~/X11RDP-o-Matic/
sudo ./

Optional Steps

Fix en-GB keyboard layout:

cp km-0809.ini /etc/xrdp/

sed -i '/\[default_rdp_layouts\]/a rdp_layout_gb=0x00000809' /etc/xrdp/xrdp_keyboard.ini

sed -i '/\[default_layouts_map\]/a rdp_layout_gb=gb' /etc/xrdp/xrdp_keyboard.ini

Set background colour of logon prompt to be black, not very light/ luminescent blue:

sed -i 's/ls_top_window_bg_color=009cb5/ls_top_window_bg_color=000000/g' /etc/xrdp/xrdp.ini

You can also remove unnecessary session options from xrdp-sesman as outlined below.

sudo vi /etc/xrdp/xrdp.ini
# manually remove lines associated with [xrdp2] to just before ["Session manager"] ; be sure to leave any lines including/onwards from  ["Session manager"]


Reboot your system, you should be able connect to your target system via RDP, with clipboard, audio and improved performance.




  • Pingback: Debian 8.6, Jessie, Installing Guacamole – CB-Net()

  • Pingback: Debian 8, Jessie, Enable RDP Server – CB-Net()

  • Erwin

    Hi Chris,

    I have tried to follow your guide on a fresh debian 8.6 install in a Hyper-V based VM and ran into a few problems. After a few hours of debugging I got XRDP working without the sound, which is a big win for me.
    I hope I can help others who run into these types of issues.

    First note, don’t use GNOME. it took me some searching to understand GNOME does not work nicely with XRDP. In my opinion this is due to incorrect handling of of the failing display-size reporting from xrandr, but I have not further investigated. When I configured the box with GNOME it first worked ok from the console, but after a reboot it started failing completely. I now use KDE and it works much better.

    Second, in your rsa-key setup it says to use:
    sudo xrdp-keygen xrdp /etc/xrdp/rsakeys.ini auto

    this doesn’t work (and me not looking at the output didn’t help in finding this the first time).

    you can either use:
    sudo xrdp-keygen xrdp /etc/xrdp/rsakeys.ini
    sudo xrdp-keygen xrdp auto

    last, it’s a good idea to set the requested resolution in the RDP client, I am running a 2560×1440 session from a macbook pro and it’s stunning.

    I want to thank you for your great write-up. It was by far the best guide so far for a workable linux GUI virtual desktop deployment.

    best regards,


    • Chris Bradford

      Erwin, thanks for this – I have updated the xrdp-keygen command as I have also learnt by default this only uses a 512bit key, so adjusted the command to use 2048. I have also reflected your comments around GNOME, I myself tried this and got a swathe of error messages, wheres KDE or XFCE work just fine.

      Did you follow the pulseaudio steps to get sound working?

      Worth taking a look at the guacamole posts I’ve recently done, makes managing yur connections really simple 🙂

    • chrismbradford

      Erwin, thanks for this – I have updated the xrdp-keygen command as I
      have also learnt by default this only uses a 512 bit key, so adjusted the
      command to use 2048 bit. I have also reflected your comments around GNOME, I
      myself tried this and got a swathe of error messages, wheres KDE or
      XFCE work just fine.

      Did you follow the pulseaudio steps to get sound working?

      Worth taking a look at the guacamole posts I’ve recently done, makes managing yur connections really simple

      • Erwin

        Hi Chris,

        Just did the audio part. All working now.
        I noticed you mentioned the text in bold, which is not very clear in my browser. you might want to change it to something like: modify the 5.0 version to the appropriate version for you installation. In debian 8.6 this is pulse audio 5.0, so the title of the document kinda gives it away 😉

        second thing tiny bit:

        “sudo sed -i ‘s/PULSE_DIR = /home/lk/pulseaudio-1.1/PULSE_DIR = /home/chris/Downloads/pulseaudio-5.0/g’ Makefile”

        the 2nd path refers to your home directory (which happens to be different from mine). you might want to change the sed statement or mention something about it in the comments.

        I can’t get it to work in Konqueror yet, but it plays the test-sounds, so technically it works :).


        • chrismbradford

          I’ve switched the path to /tmp – thought I had removed all of these!

          I’ve also tried to better reflect the need to change the version number.

          Thanks for your feedback 🙂

  • Korwin-Mikke

    Installed just for tests and works great. However I don’t need it – how to uninstall it? Please help. Thank you.

  • funnyfarm299

    Tried it on a fresh build of Debian 8.7
    failed on building X11RDP
    make[1]: Leaving directory ‘/home/localuser/X11RDP-o-Matic/work/xrdp-0.9.1 x
    x dh_installdocs x
    x cp: cannot stat ‘prog_std.txt’: No such file or directory x
    x dh_installdocs: cp -a prog_std.txt debian/xrdp/usr/share/doc/xrdp returned x
    x debian/rules:22: recipe for target ‘binary’ failed x
    x make: *** [binary] Error 2 x
    x dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit sta x
    mv: cannot stat ‘xrdp*.deb’: No such file or directory

  • Alex Wijoyo

    Hi, does anyone here know how to install X11RDP-o-Matic on Ubuntu Server 16.04

  • Tom Cruise


    I am trying to setup xrdp on Debian 8 with your hints, but there seem to have changed some things:

    As$XRDPBRANCH/readme.txt does not exist anymore, the script terminates. I removed it and changed VERSION=0.9.1+master

    Second problem is, that the script terminates on compiling – I think, the patch-file does not fit anymore. If I try to compile without using all the core, the script terminates immediately. If I chose to user all the cores, I get:
    patching file
    Hunk #1 FAILED at 250.
    1 out of 1 hunk FAILED — saving rejects to file

    Can you give me a hint on how to proceed?


  • Korwin-Mikke

    We need a new version, please. I will pay.