Skip to content

Instantly share code, notes, and snippets.

@pcan
Last active May 3, 2019 10:42
Show Gist options
  • Save pcan/979bfe1a0d462aa48399194fe19fbcf1 to your computer and use it in GitHub Desktop.
Save pcan/979bfe1a0d462aa48399194fe19fbcf1 to your computer and use it in GitHub Desktop.
XRDP Configuration for Xubuntu 16.04

XRDP Configuration for Xubuntu 16.04

This guide includes some content from the official guide "Building on Debian 8", plus some updates.

Prerequisites

Tested on Xubuntu 16.04, fresh install. I'm using xrdp v.0.9.6 in this guide: some adaptations may be necessary for other releases. Since the official guide uses an environment variable during the build, the whole setup should be performed within a single shell console.

Dependencies

Install xrdp's dependencies:

sudo apt-get install git autoconf libtool pkg-config gcc g++ make  libssl-dev libpam0g-dev libjpeg-dev libx11-dev libxfixes-dev libxrandr-dev  flex bison libxml2-dev intltool xsltproc xutils-dev python-libxml2 g++ xutils libfuse-dev libmp3lame-dev nasm libpixman-1-dev xserver-xorg-dev-hwe-16.04

Create a directory for building:

sudo mkdir /opt/xrdp
sudo chmod 777 /opt/xrdp
cd /opt/xrdp

Building XRDP from sources

Get the sources for xrdp & xorgxrdp:

BD=`pwd`
mkdir -p "${BD}"/git/neutrinolabs
cd "${BD}"/git/neutrinolabs
wget https://github.com/neutrinolabs/xrdp/releases/download/v0.9.6/xrdp-0.9.6.tar.gz
wget https://github.com/neutrinolabs/xorgxrdp/releases/download/v0.2.6/xorgxrdp-0.2.6.tar.gz

Build and install xrdp server (Adapt the configure line to activate your needed features).

cd "${BD}"/git/neutrinolabs
tar xvfz xrdp-0.9.6.tar.gz
cd "${BD}"/git/neutrinolabs/xrdp-0.9.6
./bootstrap
./configure --enable-fuse --enable-mp3lame --enable-pixman
make
sudo make install
sudo ln -s /usr/local/sbin/xrdp{,-sesman} /usr/sbin

Build and install xorgxrdp:

cd "${BD}"/git/neutrinolabs
tar xvfz xorgxrdp-0.2.6.tar.gz
cd "${BD}"/git/neutrinolabs/xorgxrdp-0.2.6
./bootstrap
./configure
make
sudo make install

Configuration and final steps

Open /etc/X11/Xwrapper.config and replace allowed_users=console with allowed_users=anybody.

Open /etc/xrdp/sesman.ini and change the FuseMountName value as follows:

[Chansrv]
FuseMountName=.mounts/.thinclient_drives

Now we're going to set the keyboard layout, change it with yours. Open /etc/xrdp/reconnectwm.sh and add the following lines at the end:

mkdir -p ~/.mounts
if xhost > /dev/null 2>&1 ;
then
    sleep 3
    setxkbmap -layout it
fi

Open ~/.profile and add the same lines:

mkdir -p ~/.mounts
if xhost > /dev/null 2>&1 ;
then
    sleep 3
    setxkbmap -layout it
fi

Optional: cleaning up connection types

Now we're going to remove other session options, so the login screen will display Xorg as the only available choice. Run:

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

Now edit /etc/xrdp/xrdp.ini and remove all connection sections, except the [Xorg] one.

Install and start the xrdp service

Run the following commands:

sudo systemctl enable xrdp
sudo service xrdp start

Now you should be able to connect to <<host>>:3389 with the RDP client of your choice.

Optional: make the system headless

Do this step if you plan to use the GUI only via RDP. After this step, the OS will take just ~90MB of RAM when no clients are connected.

sudo systemctl disable lightdm

If you need the GUI again, run the following command and restart:

sudo ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service

Optional: bandwidth saving

In order to save bandwidth, un-tick the Enable display compositing checkbox in Settings -> Windows Manager Tweaks -> Compositor

Optional: Java GUI rendering parameters

When using Java-based GUI applications, add -Dsun.java2d.xrender=true to JVM startup arguments in order to improve speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment