-
Notifications
You must be signed in to change notification settings - Fork 59
Single guest session over NFS
The goal here is to have a single guest session (user) which is loaded over NFS from an RO mount. The computers /home
folder are created based on MAC addresses and everything is wiped upon reboot as the NFS mount decides how the guest session should look like.
Everything is saved, even settings, which means that you administer the guest account on the server and don't have to make the changes on every single PC.
In addition, the clients will PXE boot from the server.
- Ubuntu 18.04 MATE (i386 or x64) that will act as the LTSP server
- LTSP 2019
- Client PCs that are PXE booting
To install LTSP visit the installation docs.
Run this to create a .conf file: install -m 0660 -g sudo /usr/share/ltsp/common/ltsp/ltsp.conf /etc/ltsp/ltsp.conf
Under the clients section, set these value with the ip addresses you use:
# FSTAB_HOME="server:/home /home nfs defaults,nolock 0 0"
##### https://github.com/ltsp/community/issues/47#issuecomment-549017534
POST_INIT_CREATE_DIRS="
/usr/lib/klibc/bin/nfsmount 192.168.2.4:/home/nfs /mnt
mkdir -p /mnt/$MAC_ADDRESS/home/guest
chown guest:guest /mnt/$MAC_ADDRESS/home/guest
umount /mnt
mkdir -p /etc/guest-template
sed 's|^Exec=|&/etc/ltsp/ltsp-session |' -i /usr/share/xsessions/*.desktop
/usr/lib/klibc/bin/nfsmount -o nolock 192.168.2.4:/home/nfs/$MAC_ADDRESS/home /home
/usr/lib/klibc/bin/nfsmount -o nolock,ro 192.168.2.4:/home/guest /etc/guest-template
"
# Autologin on boot and when logging out
AUTOLOGIN="guest"
POST_INIT_ENABLE_EPOPTES_CLIENT="systemctl enable --quiet --root=/ --no-reload epoptes-client"
LIGHTDM_CONF="allow-guest=false"
# In some cases very old client PCs might need longer time to login.
RELOGIN_TIMEOUT=4
# DP-1 output doesn't work without this:
POST_INIT_ENABLE_DP1="echo on > /sys/class/drm/card0-DP-1/status"
# CRONTAB reboots the client at 21:30
CRONTAB_x="30 21 * * * reboot"
Under the server section set this (optional)
Hides the ipxe menu
MENU_TIMEOUT="-1"
- Create a new account on the server called "guest"
- Configure it how you would like it to look
- Logout
Install FreeRDP
If you intend to use the client for RDP, these are the steps to take.
sudo apt install freerdp2-x11
Add shortcuts for FreeRDP
This is what I entered as a .desktop file under /home/guest
, yours might be different:
# LANDSKRONA01
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Icon=computer
Icon[en_US]=computer
Name[en_US]=LANDSKRONA01
Comment[en_US]=Anslut till LANDSKRONA01
Exec=xfreerdp /v:192.168.7.77 /f /bpp:8 /kbd:Swedish /fonts /d:DOMAIN /sec:tls /u:'' /cert-ignore /sound /compression /fonts /network:broadband
Name=LANDSKRONA01
Comment=Anslut till LANDSKRONA01
sudo mkdir /home/nfs
sudo nano /etc/exports.d/local.exports
- Paste this:
/home/nfs *(rw,async,crossmnt,no_subtree_check,no_root_squash,insecure)
/home/guest *(ro,async,crossmnt,no_subtree_check,no_root_squash,insecure)
-
sudo exportfs -ra
-
Create a file with
nano /etc/ltsp/ltsp-session
and paste this
#!/bin/bash
rsync -a --delete /etc/guest-template/ /home/guest/
exec "$@"
sudo chmod +x /etc/ltsp/ltsp-session
This makes the server /home/guest available in read-only mode in the client /etc/guest-template, while the /home/guest on the client actually maps to a different server directory for each client, /home/nfs/$MAC_ADDRESS/home
Run these commands and reboot the client:
ltsp image /
ltsp initrd
ltsp ipxe