I've been using a bash script run daily by a JSS policy to mount a Windows server share, synchronize its contents locally on every machine and then unmount the share. This has worked until Lion came along. It seems that 'mount_smbfs' won't authenticate properly when run as root. Here is the stripped down script with comments and error checking removed:
CLIENTPATH=/Users/Shared/Test
SERVERURL='//DOMAIN;botuser:password@server.designory.com/Test'
SERVERMOUNT=/Volumes/Test
SERVERPATH="/"
mkdir "$SERVERMOUNT"
/sbin/mount_smbfs -o nobrowse $SERVERURL "$SERVERMOUNT"
/usr/bin/rsync -aEu --exclude ".DS_Store" --exclude "Thumbs.db" --exclude ".T*" "$SERVERMOUNT$SERVERPATH" "$CLIENTPATH" --delete-after
chmod -R u=rwX,go=rX "$CLIENTPATH"
diskutil unmount "$SERVERMOUNT"
This works just fine when run as any user other than root.
Anyone else mounting SMB shares via a script that has found a workaround for this? Any suggestions on an alternate method to accomplish this task?
Thanks for any help.