Skip to content
Jeffrey Hein edited this page Sep 16, 2021 · 45 revisions

Remote Desktop Kiosk This requires LightDM. Be sure to install it and configure it as the default DM. GDM3, SDDM and NODM are a work in progress. There are slightly different configs for Gnome2 and Gnome3. I used Ubuntu 21.04 Desktop fresh install, and then followed the LTSP install docs here: https://ltsp.org/docs/

Install LightDM

sudo apt install lightdm

Install default ltsp.conf

install -m 0660 -g sudo /usr/share/ltsp/common/ltsp/ltsp.conf /etc/ltsp/ltsp.conf

Edit ltsp.conf

nano -w /etc/ltsp/ltsp.conf

Under the [clients] section, set these values:

# Create a user that is local to the client, so that authentication/SSHFS/NFS aren't needed:
PRE_INIT_KIOSK_USER='mkdir -p /run/home && useradd --base-dir=/run/home --comment="kiosk user" --create-home --shell=/bin/bash --system kiosk'

# Enable autologin for that user:
AUTOLOGIN=kiosk

# If autologin doesn't work with UBUNTU >= 20.04 ( https://github.com/ltsp/ltsp/discussions/281 ) try add this
RELOGIN=0

# Create an appropriate session in /etc/ltsp, then symlink it:
POST_INIT_XFREERDP_SESSION="ln -s /etc/ltsp/xfreerdp.desktop /usr/share/xsessions/xfreerdp.desktop"

# And set it as the default session of this user:
LIGHTDM_CONF='user-session=xfreerdp'

#GNOME 2 (MATE?)
#In GNOME 2, the .dmrc file in the user home directory was used to create default sessions. This .dmrc file is no longer used in GNOME 3.
#POST_INIT_KIOSK_DMRC='printf "[Desktop]\nSession=xfreerdp\n" > /run/home/kiosk/.dmrc'

#GNOME 3
#To specify a default session for a user, update the user’s account service in the #/var/lib/AccountsService/users/username file:
##[User]
##Language=
##XSession=xfreerdp
#GDM3_CONF='XSession=xfreerdp' #Maybe?

Optional: Under [common] section add:

# Disable iPXE menu
MENU_TIMEOUT="-1"

sudo ltsp ipxe

Edit custom session

nano -w /etc/ltsp/xfreerdp.desktop

[Desktop Entry]
Name=XTERM
Comment=This session just runs an XTERM
Exec=xterm
TryExec=xterm
Icon=xterm
Type=Application
DesktopNames=XTERM
Keywords=launch;XTERM;desktop;session;

Then run ltsp initrd

This doesn't run xfreerdp. It just runs xterm (install it if you don't have it). Then from that xterm, you can play with xfreerdp and its parameters (e.g. xfreerdp /v:server /f /u:''), and once you get this right, just modify the Exec= line in /etc/ltsp/xfreerdp.desktop, and run ltsp initrd to propagate it to the client.

P.S. after you get this going, you may optimize it by running the lighter "nodm" instead of "lightdm"; I can add code in LTSP that makes AUTOLOGIN work in nodm too at that point.


Example RDP script using xfreerdp with a zenity username and password prompt.

nano -w /etc/ltsp/xfreerdp.desktop

[Desktop Entry]
Name=xfreerdp
Comment=This session runs Remote Desktop
Exec=/etc/ltsp/xrdp
TryExec=/etc/ltsp/xrdp
Icon=xfreerdp
Type=Application
DesktopNames=xfreerdp
Keywords=launch;xfreerdp;desktop;session;

sudo nano /etc/ltsp/xrdp

#!/bin/bash
RDP_SERVER=""
RDP_DOMAIN=""
WELCOME_TITLE="Welcome"
WELCOME_WIDTH="600"
WELCOME_HEIGHT="600"
WELCOME_URL="https://ltsp.org/"
RDP_OPTIONS="/sound /microphone /rfx /multitransport /network:auto /gfx:AVC444 /f /multimon /cert-ignore /drive:hotplug,* +fonts"

x-window-manager &
        xset s off         # don't activate screensaver
        xset -dpms         # disable DPMS (Energy Star) features.
        xset s noblank     # don't blank the video device
        zenity --text-info --ok-label "OK" --cancel-label "Xterm" --title=$WELCOME_TITLE --width=$WELCOME_WIDTH --height=$WELCOME_HEIGHT  --html --url=$WELCOME_URL
        if [[ $? -eq 1 ]]; then
		xterm && $0
	else
		/usr/bin/xfreerdp /v:$RDP_SERVER /d:$RDP_DOMAIN $RDP_OPTIONS \
/u:$(zenity \
--entry \
--title="Username" \
--text="Please enter your first name:") \
/p:$(zenity \
--entry \
--title="Passphrase" \
--text="Please enter your _passphrase:" \
--hide-text)
	fi
$0

sudo chmod +x /etc/ltsp/xrdp

sudo ltsp initrd

#Install freerdp2, mutter and zenity if you don't have them

sudo apt install freerdp2-x11 zenity mutter && sudo ltsp image /

You may want to install the freerdp-nightly for the most recent improvements: Add the following entry to a sources list: deb http://pub.freerdp.com/repositories/deb/hirsute/ freerdp-nightly main The package is called freerdp-nightly and binaries and libraries are installed to /opt/freerdp-nightly/ To get they apt key: wget -O - http://pub.freerdp.com/repositories/ADD6BF6D97CE5D8D.asc | sudo apt-key add -

For more information on Sound and Microphone forwarding options in xfreerdp see: https://jphein.com/cloud-computing-with-microphone-redirection-using-ubuntu-18-10-ltsp-thin-clients-and-windows-2016-datacenter-servers/

You could select the RDP_SERVER by client ip address in /etc/ltsp/xrdp

LOCAL_IP=$( ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' )

case $LOCAL_IP in
    "10.0.0.100")
        RDP_SERVER="10.0.0.1"
        ;;
    "10.0.0.101")
        RDP_SERVER="10.0.0.2"
        ;;
    *)
        RDP_SERVER="10.0.0.1"
        ;;
esac

You might get this rsync error: https://github.com/ltsp/ltsp/issues/450 ... If anyone wants to try out LTSP in Ubuntu 21.04, they'll need these lines in ltsp.conf:

#Under [clients]
# Work around LTSP issue #388
PRE_INITRD_BOTTOM_RSYNC='chroot() { re mount --bind /proc "$1/proc"; re /bin/chroot "$@"; re umount "$1/proc"; }'
# Work around LTSP issue #450
PAM_AUTH_TYPE=Primary