Hello everyone, I noticed there are already several open/closed discussions regarding network volume mounting with JSS
I tried the script included in the Resource Kit but I don't like the idea of having a launch agent left on the client side, so I tried to put together something myself
Environment is an AD domain with network users
The very rough script below grabs the full path from JSS parameters, so that you can add several shares within a single policy
It works when executed locally (hard coding the path) but has issues with a login policy because it runs as the root user (predictable), not the logged one
The result is network shares are correctly being mounted but they're not accessible (locked), likely because the mountpoint has wrong permissions
I tried gathering the network user at login with
loggedInUser=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
But could not make it work within the script
Any help from the scritpting gurus out there will be highly appreciated...
Thank you all
Carlo
#!/bin/bash
# Automatic volume mounting with a valid kerberos ticket
# Network shares parameters are passed by Casper
# Variables being used are $4 to $11
##Cycling with variables passed by JSS for each volume to be mounted
for var in "$4" "$5" "$6" "$7" "$8" "$9" "$10" "$11"
do
if [ "$var" != "" ]; #check if Casper parameter is empty
then
#Gather path to the network shares
SHARE=${var:18} #Get network share
SHARE=${SHARE%/} #Delete forward slash
HOST=${var:6:11} #get host name
MOUNT=${var:6} #Share to be mounted
PROTOCOL=${var:0:3} #Protocol being used (afp or smb from full path declared in JSS)
VOL="/Volumes/$SHARE" #mountpoint from the share
ping -t 1 -c 1 $HOST > /dev/null
if [[ $? -eq 0 ]] #check if host is reachable with ping
then
if [ "$PROTOCOL" == "afp" ]; #check protocol being used
then
mkdir $VOL #create mountpoint for afp
mount_afp –i "afp://;AUTH=Client%20Krb%20v2@$MOUNT" $VOL #Mount Volume afp
else
mkdir $VOL #create mountpoint for smb
mount -t smbfs "smb://$MOUNT" $VOL #Mount Volume smb
fi
fi
fi
done