#!/bin/sh #This mounts the local devices from the clients #Copyright 2005 Henry Burroughs/Hilton Head Preparatory School # This is licensed under the GPL #Version 1.1 #Note, if this does not work, see the workaround below about the ":" #This is where the client access files are stored # ie, this is where we get the permissions for mount so only that user can access the files LOCALDEV="/var/lib/localdev" #Other mount options (don't set uid=... the script will do that below)! OPTS="-fstype=smbfs,guest,gid=root,fmask=770,dmask=770" #Share off the client to mount...default is "drives" SHARE="drives" #This is the client to mount from CLIENT="$1" #Now the magic.... #Ping the client, to see if they are still operational.. if they are not, whack (delete) # the file in LOCALDEV ping -q -c 1 $CLIENT > /dev/null 2>&1 if [ $? -ne 0 ] then if [ -f $LOCALDEV/$CLIENT ] then rm $LOCALDEV/$CLIENT fi exit fi #Check and see if $LOCALDEV exists, if not, create it if [ ! -d $LOCALDEV ] then mkdir $LOCALDEV chmod 700 $LOCALDEV fi #Look for hostname file in the $LOCALDEV dir if [ -f $LOCALDEV/$CLIENT ] then USER=`echo $LOCALDEV/$CLIENT` else exit fi #On early versions of Redhat/Fedora systems, you need to omitt the : before // # This version is for Centos 4.1 (Aka RHEL 4.1) echo "$OPTS,uid=`cat $LOCALDEV/$CLIENT` / ://$CLIENT/$SHARE"