Linux Mint 13: LTSP, Guest Account and Epoptes Installation

Here is how I installed and configured LTSP on Linux Mint 13 32-bit. My LTSP server has two network cards, eth0 connected to internet through a router and eth1 for ltsp clients.

1. Install package “ltsp-server-standalone” using apt-get:

sudo apt-get install ltsp-server-standalone

or synaptic:

mint_ltsp_1

2. From console (terminal) execute following commands:

sudo cp -R /usr/share/ltsp/plugins/ltsp-build-client/Ubuntu /usr/share/ltsp/plugins/ltsp-build-client/LinuxMint
sudo ln -s /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/maya
sudo sed -i 's/DIST=${DIST:-"$(lsb_release -s -c)"}/DIST=${DIST:-"precise"}/' "/usr/share/ltsp/plugins/ltsp-build-client/LinuxMint/000-basic-configuration"
sudo ln -s /usr/share/ltsp/plugins/ltsp-build-client/Debian-functions /usr/share/ltsp/plugins/ltsp-build-client/LinuxMint-functions

3. Build ltsp client:

sudo ltsp-build-client --arch i386

4. Add following entry to “/etc/network/interfaces” file:

auto eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0

5. To make sure dhcp server only response to the second ethernet card, put interface “eth1” to file “/etc/default/isc-dhcp-server”:

INTERFACES="eth1"

6. At this point LTSP server is ready, you can try it by restarting the server and boot ltsp clients from network. But we want to go on setting up guest accounts. To activate guest account, create a new lts.conf file “/var/lib/tftpboot/ltsp/i386/lts.conf” and add following lines:

[Default]
LDM_GUESTLOGIN=True
LDM_PASSWORD=secret

7. Add guest user names:

sudo adduser ltsp20
sudo adduser ltsp21

8. Now you can try to login from ltsp client using guest account.

mint_ltsp_2

9. Now we want to automatically clean up guest home directory every time guest log in. Create a new file “/opt/ltsp/i386/usr/share/ldm/rc.d/S00-guest-sessions” and put following text in it:

case "$LDM_USERNAME" in
    ltsp*)
        ssh -S "$LDM_SOCKET" "$LDM_SERVER" 'cd; rm -rf .* *; rsync -a /etc/skel/ .'
        ;;
esac

10. Save the file and run “ltsp-update-image”:

sudo ltsp-update-image

11. Install “epoptes” using apt-get:

sudo apt-get install epoptes

or synaptic:

mint_ltsp_3

12. Add user to group epoptes:

sudo gpasswd -a <username> epoptes

13. Install epoptes-client to ltsp client:

sudo chroot /opt/ltsp/i386
apt-get install epoptes-client
epoptes-client -c
exit

14. Update ltsp image:

sudo ltsp-update-image

15. Reboot the server, start clients and run epoptes.

mint_ltsp_4

16. Fix for Mate desktop manager. Save following script as “endsession”:

#!/bin/sh
###########################################################################
# Requests a logout, reboot or shutdown.
# Currently it supports Gnome, KDE, XFCE and LXDE.
# Usage: endsession --logout|--reboot|--shutdown
#
# Copyright (C) 2011 Alkis Georgopoulos <alkisg@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# On Debian GNU/Linux systems, the complete text of the GNU General
# Public License can be found in `/usr/share/common-licenses/GPL'.
###########################################################################
die() {
echo "$@" >&2
exit 1
}
is_root() {
test $(id -u) -eq 0
}
is_ltsp() {
test -n "$LTSP_CLIENT"
}
do_logout() {
# Reset the xprop in case the user asks for a reboot, cancels it
# (e.g. unsaved work), and then he asks for a logout instead.
if [ $action = "logout" ] && is_ltsp; then
# LTSP_LOGOUT_ACTION might not exist, but we don't care
xprop -root -remove LTSP_LOGOUT_ACTION 2>/dev/null
fi
# Gnome
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.gnome.SessionManager /org/gnome/SessionManager \
org.gnome.SessionManager.Logout uint32:1 2>&1 && return
# KDE
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout \
int32:0 int32:0 int32:0 2>&1 && return
# Mate
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.mate.SessionManager /org/mate/SessionManager \
org.mate.SessionManager.Logout uint32:1 2>&1 && return
# XFCE
xfce4-session-logout --logout 2>&1 && return
# LXDE
test -n "$_LXSESSION_PID" && kill "$_LXSESSION_PID" && return
die "I don't know how to logout in this environment"
}
do_reboot() {
if is_root; then
reboot && return
elif is_ltsp; then
# Notify ldm that we want to reboot after logoff
xprop -root -f LTSP_LOGOUT_ACTION 8s -set LTSP_LOGOUT_ACTION REBOOT
do_logout && return
fi
# Gnome
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.gnome.SessionManager /org/gnome/SessionManager \
org.gnome.SessionManager.RequestReboot 2>&1 && return
# KDE
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout \
int32:0 int32:1 int32:0 2>&1 && return
# Mate
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.mate.SessionManager /org/mate/SessionManager \
org.mate.SessionManager.RequestReboot 2>&1 && return
# XFCE and LXDE 
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement \
org.freedesktop.PowerManagement.Reboot 2>&1 && return
# ConsoleKit is the last resort since it doesn't allow inhibiting
dbus-send --system --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Restart 2>&1 && return
die "I don't know how to reboot in this environment"
}
do_shutdown() {
if is_root; then
poweroff && return
elif is_ltsp; then
# Notify ldm that we want to poweroff after logoff
xprop -root -f LTSP_LOGOUT_ACTION 8s -set LTSP_LOGOUT_ACTION HALT
do_logout && return
fi
# Gnome
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.gnome.SessionManager /org/gnome/SessionManager \
org.gnome.SessionManager.RequestShutdown 2>&1 && return
# KDE
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout \
int32:0 int32:2 int32:0 2>&1 && return
# Mate
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.mate.SessionManager /org/mate/SessionManager \
org.mate.SessionManager.RequestShutdown 2>&1 && return
# XFCE and LXDE 
dbus-send --session --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.freedesktop.PowerManagement /org/freedesktop/PowerManagement \
org.freedesktop.PowerManagement.Shutdown && return
# ConsoleKit is the last resort since it doesn't allow inhibiting
dbus-send --system --type=method_call --print-reply --reply-timeout=2000 \
--dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Stop 2>&1 && return
die "I don't know how to shutdown in this environment"
}
# main
# Hide all dbus output unless DEBUG is set.
test -z "$DEBUG" && exec >/dev/null
case "$1" in
-l|--logout)
action=logout
;;
-r|--reboot)
action=reboot
;;
-s|--shutdown)
action=shutdown
;;
*)
die "Usage: endsession --logout|--reboot|--shutdown"
;;
esac
do_$action

17. Copy file “endsession” into directories “/usr/share/epoptes-client” and “/opt/ltsp/i386/usr/share/epoptes-client”:

sudo cp endsession /usr/share/epoptes-client
sudo cp endsession /opt/ltsp/i386/usr/share/epoptes-client

18. Update ltsp image:

sudo ltsp-update-image

19. As I want to use this server for demonstration purpose, I want to clear up dhcp lease every time the server boots. To do that just add these two lines into file “/etc/rc.local” above line “exit 0”:

rm /var/lib/dhcp/*
service isc-dhcp-server restart

20. That’s it. Enjoy your new LTSP system!