Posted on 08-17-2010 10:04 AM
Hello, we recently started using Casper Suite and have come up against our first issue: how to handle mounting multiple SMB shares at login.
Currently, I'm trying to mount two shares at login for students in a lab. In the Finder, I can use "Connect to Server" to mount each share. I downloaded the resource kit, modified the values in the mountNetworkShare.sh file twice (one for each share), renamed the scripts, and dragged them in to Casper Admin. Then I created two new policies (one for each script) using the Login trigger. When logging in, one share mounts, the other does not.
The following info shows up in the log for the share that does not mount:
8/17/10 9:04:17 AM com.jamfsoftware.mapdrive.students.charlie.test[37939] osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
8/17/10 9:04:17 AM com.jamfsoftware.mapdrive.students.charlie.test[37939] 0:65:
8/17/10 9:04:17 AM com.jamfsoftware.mapdrive.students.charlie.test[37939] execution error: Application isn’t running. (-600)
Google reveals that "execution error: Application isn’t running. (-600)" has something to do with running a osascript when the windowserver or Finder is not available. The strange thing is that the script that works mounts before this error is thrown, so I'm unsure why this error doesn't appear for the first share.
Has anybody run across this before?
Is there a better way to handle multiple SMB shares at login? I have another scenario that involves mounting between 5-7 shares...
Thanks,
Charlie Ahn
CSU Channel Islands
Posted on 08-17-2010 11:20 AM
I don’t change a thing in the resource kit script. I just add that script once to the system and make sure I configure what the attributes mean. Then I just make a policy against that script and configure my attributes for that script in the policy. See attached screens I sent out earlier.
I mount two shares at login, not including their network home from Active Directory, and that’s worked well on 10.6. On 10.5 this was not reliable. What OS are you running?
Craig E
Posted on 08-17-2010 01:32 PM
I'm running 10.6.4. I imported the script as-is and changed the parameters as you showed. I still get the same error, "execution error: Application isn’t running. (-600)"
Inside the script, it says that there is a bug with using mount_smbfs in 10.6 (script was last updated April, 2010), does anybody know what that bug is exactly, and if it has been fixed by now in 10.6.4? It looks like 10.6 clients use osascript to mount the smb share, while 10.5 and earlier uses mount_smbfs. Since osascript seems to be causing my issue, I tried manually using the mount_smbfs command in the terminal and it worked. I'm curious about the "bug" especially if it's something that isn't obvious at first...
Charlie Ahn
CSU Channel Islands
---------------
Starting on Line 182 of the mountNetworkShare.sh:
if [ "$mountType" == "smb" ]; then
if [[ "$OS" < "10.6" ]]; then
#Write out a launch agent
/usr/bin/su -l $loginUsername -c "/usr/bin/defaults write ~/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName ProgramArguments -array /bin/sh -c "/bin/mkdir /Volumes/$3; /sbin/mount_smbfs //$loginUsername@$serverAddress/$share /Volumes/$3""
else
#Apple bug in 10.6 prevents us from using mount_smbfs... if that bug gets fixed, we will revert to it
#/usr/bin/su -l $loginUsername -c "/usr/bin/defaults write ~/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName ProgramArguments -array /bin/sh -c "/bin/mkdir /Volumes/$3; /sbin/mount_smbfs //$loginUsername@$serverAddress/$share /Volumes/$3""
#Write out a launch agent
echo "Writing out launch agent to /Users/$loginUsername/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName.plist"
/usr/bin/su -l "$loginUsername" -c "/usr/bin/defaults write ~/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName ProgramArguments -array /bin/sh -c replaceMe"
#Write in the proper mount command to the plist. Using sed because defaults write doesn't like quotes or double quotes.
/usr/bin/su -l "$loginUsername" -c "/usr/bin/plutil -convert xml1 ~/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName.plist"
/usr/bin/sed "s:replaceMe:/usr/bin/osascript -e 'mount volume ("smb://$serverAddress/$share")':g" "/Users/$loginUsername/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName.plist" > "/private/tmp/com.jamfsoftware.mapdrive.$LaunchdFileName.plist.tmp"
/bin/mv "/private/tmp/com.jamfsoftware.mapdrive.$LaunchdFileName.plist.tmp" "/Users/$loginUsername/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName.plist"
/usr/sbin/chown "$loginUsername":staff "/Users/$loginUsername/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName.plist"
/bin/chmod 644 "/Users/$loginUsername/Library/LaunchAgents/com.jamfsoftware.mapdrive.$LaunchdFileName.plist"
fi
else
Posted on 08-17-2010 01:47 PM
I was having problems with that script myself so what I ended up doing was I created a policy to have Casper run a command.
sudo -u username mkdir /Volumes/Test/; sudo -u username mount -t smbfs //username:password at 10.125.1.20/Test /Volumes/Test
You have to make sure you specify the user (the -u switch) when sending a command through casper for something like this because it runs the command as root and if it is creating the directory to mount the volume it will be created as such and the user will not have access to the mounted volume even if it has correct permissions to it.
Then I have another policy that runs at logout
umount /Volumes/Test
hope this helps
-Josh
Re: [Casper] using mountNetworkShare.sh with Login trigger
Ahn, Charles
to:
Ernst, Craig S., Casper List
08/17/2010 03:36 PM
Posted on 08-18-2010 06:09 AM
Hi all,
I just saw mention of the Adobe Unit Types.osax" in the previous post surface again. I'm trying to find a way to test the version of "/Library/ScriptingAdditions/Adobe Unit Types.osax" and create a smart group for those with less than v 2.1.0 running on 10.6 systems so I can target an update. I figure an extension attribute is the way to go, but cannot for the life of me successfully pull a version from the info.plist or similar. Could anyone shed any light?
Best regards,
Tim Morris
Queensland University of Technology
Posted on 08-19-2010 06:10 AM
So I'm not seeing this because I'm working with CS5, and that's a good time
in and of itself. =)
http://www.jamfsoftware.com/kb/article.php?id=257
Basically, they threw in a 32 bit Scripting Addition at "/Library/Scripting
Additions/" when in 10.6, only 64 bit scripting additions are supported.
This completely breaks AppleScript, so it's kind of a combination of "good
old Adobe" and "good old Apple" (throwing an incompatible scripting addition
into a folder should not break AppleScript altogether, but it does for this
case)
If you remove that or update the Adobe Type Units scripting addition
according to the KB, that should clear it up.
William hit on this, too.
Craig E