Automount Windows Samba shares over Novell

Apr 04, '07 07:30:02AM

Contributed by: comboprime

There are many hints and Forum discussions about automounting Samba shares, but none seemed to work over our Novell network. Just doing Connect to Server or the equivalent "mount volume" are insufficient -- the share must be mounted to a defined mount point. The following AppleScript solved our problems:

tell application "Finder"
  try
    make new folder at alias "Macintosh HD:Volumes:" with properties {name:"share"}
  end try
end tell

do shell script "mount_smbfs -I ip_address -W WORKGROUP -U userid //server_name/share /Volumes/share"

try
  tell application "Finder" to quit
end try

delay 2

tell application "Finder" to activate

Replace Macintosh HD, ip_address, WORKGROUP, server_name, userid, and share with the appropriate values. First, the script tries to create the needed mount points. If the folders exist, the try will silently fail. (OS X will erase these folders if the servers are unmounted, so you need to check each time before mounting.)

Next, the do shell script runs the command-line executable without opening Terminal. When the system prompts for a password, it's a Finder dialog. Clicking "Remember this password in my keychain" before typing in the password (and clicking OK) will bypass the dialog on future logins. Finally, the Finder needs to be restarted before it will recognize the mounted drives. Apparently a slight delay is needed between the quit and restart commands.

If you save the AppleScript as an application (preferably in ~/Library » Scripts), you can add it to your Login Items (found under System Preferences » Account), and the script will run every time the user restarts or logs in.

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20070402113705592