Note: Almost all content here will eventually be revised and merged into the live-manual. Please do not add new content to the wiki, but contribute to the manual directly. |
This page provides a demonstration example of a model which will mount a users network home on to a folder in /home/user/Desktop with samba as the Network User Authenticator. This was tested with a Netboot Image. See DebianLive/Howto/Network_Image_Server for more information.
Layout
- Create a Netboot setup with KDM and CUPS
- Build a small userauthwrapper script to mount network home on /home/user/Desktop
- Cleanup between clients upon login
userauthwrapper script
On this part know that this script is a work in progress so test out with your own stuff. Also I have a CUPS conf file named /etc/cups/cupsd.conf.master as a template I can use sed against to tweak as I need. The userauthwrapper script expects to be used as:
userauthwrapper -u userID -p userID_Password -s share1:share2:share3:shareN -h SAMBA_HOST -c CUPS_SERVER
#!/bin/sh
set -e
ARGUMENTS="`getopt --longoptions user:,pass:,host:,shares:,cups:,usage,version --name=userauthwrapper --options u:p:h:s:c:uv --shell sh -- "${@}"`"
if [ "${?}" != "0" ]
then
echo "Terminating." >&2
exit 1
fi
eval set -- "${ARGUMENTS}"
while true
do
case "${1}" in
-u|--user)
MOUNT_USER="${2}"; shift 2
;;
-p|--pass)
MOUNT_PASS="${2}"; shift 2
;;
-h|--host)
MOUNT_HOST="${2}"; shift 2
;;
-s|--shares)
MOUNT_SHARES="${2}"; shift 2
;;
-c|--cups)
CUPS_SERVER="${2}"; shift 2
;;
--)
shift; break
;;
*)
echo "Command line parser problem. Exiting." >&2
exit 1
;;
esac
done
# Set the field seperator.
IFS=:
# Spin through the shares and mount as you can.
for share in $MOUNT_SHARES
do
if [ -d ${HOME}/Desktop/${share} ];
then
# Do nothing since dir exists
echo "${HOME}/Desktop/${share} already exists!" >&2
else
# Make the directories as we need them.
echo "Making directory ${HOME}/Desktop/${share}." >&2
mkdir -p ${HOME}/Desktop/${share}
fi
mount -t smbfs //${MOUNT_HOST}/${share} ${HOME}/Desktop/${share} -o username=${MOUNT_USER},password=${MOUNT_PASS},fmask=0666
if [ "${?}" -eq "32" ]
then
echo "Mount Failure. Terminating." >&2
echo "Attempting to remove mount point." >&2
rmdir ${HOME}/Desktop/${share}
exit 1
fi
done
sed 's/Browsing Off/Browsing On/g' /etc/cups/cupsd.conf.master>/etc/cups/cupsd.conf
echo "BrowsePoll ${CUPS_SERVER}" >> /etc/cups/cupsd.conf
/etc/init.d/cupsys restart
exit 0
Cleanup between clients upon login
Since KDM does not really have a post session, I am going to use the /etc/kde3/kdm/Xstartup to just clean out any mount points that 'user' has. So add the following to the /etc/kde3/kdm/Xstartup and it will do the cleanup work between sessions.
# This will unmount any mounts with regards to 'user'.
/bin/mount | /bin/grep user | /usr/bin/awk '{print "/bin/umount -l "$1" && /bin/rmdir "$3}' | /bin/sh
# This will clean up cups.
/bin/cp /etc/cups/cupsd.conf.master /etc/cups/cupsd.conf && /etc/init.d/cupsys stop