Help me automount my smb share in Apple OS X (reward inside)
January 2, 2007 5:51 PM   Subscribe

Here's what I know: I can access my smb share without difficulty via the Finder/Network or by mounting it manually, but what I can't seem to do is automount my samba share on boot/login. There's a reward and twice more inside.

I've tried via NetInfo Manager and I've tried via niload fstab and neither seem to work for me.

Here are the nitty gritty specifics:

Server name: miles
share name: share
username: nobody
password: none (as in you don't need to supply a password for user nobody)

So I am able to do a mount manually successfully with the following:

mount_smbfs -W workgroup //nobody@miles/share ./share

(it works although I get this error when I navigate into it the first time: mount_smbfs: spnego blob2principal error 1)

Also, if I go through the Finder and Network it also works. By doing a Get Info on the share I see the following:

Kind: Volume
Server: cifs://WORKGROUP;nobody@MILES/SHARE

But no matter how I try to automount the share I don't seem to have any success. I'm wondering if the password might be the issue and how one passes an empty password in the string?

I've tried various combinations through NetInfo Manager using the following two articles as reference, without any luck. Same with using niload fstab.

I'd be willing to reward someone with an unused license to RapidWeaver or DevonThink Personal if they solve my problem.

P.S. I can give more specifics if needed.
P.P.S. No, I won't be adding any password to this mount, so lets not go there.
posted by furtive to Computers & Internet (13 answers total) 5 users marked this as a favorite
Have you tried adding the mounted share to your login items in the "Accounts" section of System Preferences? That's what did it for me in the Windows environment at my work...just a thought.
posted by lurkingular at 6:13 PM on January 2, 2007

You can also use Automator to do mounts, and then set that script to run at login.
posted by smackfu at 6:17 PM on January 2, 2007

This works, but it doesn't automatically remount the drives if they are mounted.

Open the AppleScript editor and paste in the following:

tell application "Finder"
mount volume "smb://SERVERNAME;username:password@ip_address/sharename"
end tell
end try

Edit the script to reflect your specifics. Mount multiple drives by copying the try-->end try block and changing the server and/or sharename.

Select "Save as" and choose Application as the File Type. Uncheck start-up screen.

Then go to your User Preferences and accounts and add this application as a Startup Item.
posted by McGuillicuddy at 6:27 PM on January 2, 2007 [1 favorite]

It doesn't automatically remount the drives if they become unmounted.
posted by McGuillicuddy at 6:28 PM on January 2, 2007

The apple script idea is the best (IMO). As for the remount if disconnected, you could always setup Growl to notify you in the event that it happens. I've never done it myself, but I can't see why HardwareGrowler wouldn't do the trick.
posted by purephase at 6:58 PM on January 2, 2007

Here's a list of what I've done (and I'm not at the Mac today so I can't tell you which one makes it work, but):

1)Add a shortcut to the network drive. Place on desktop.
2)Add said shortcut to the left-sidebar of Finder windows.
3)When you connect, hit the "Save in keychain" checkbox.

These are in no particular order, and may or may not need to be done at the same time. Not really sure why this works, but somehow or another it has.

I'll be at that computer tomorrow all day, so I'll see if there's anything else I've done. But it is possible from Finder (maybe Keychain) alone. No 3rd party stuff or scripts needed.
posted by niles at 7:04 PM on January 2, 2007

If you don't want to go to the trouble of all that scripting, and you just want the volume mounted on login, all you need to do is mount the drive once, save the credentials to the keychain, then open the User preferences and drag the volume's desktop icon into the Startup Items list.

That's it. Just drag the icon into the list of stuff you want done when you log in. Seriously.
posted by majick at 8:10 PM on January 2, 2007

I had to tweak the instructions a bit to get automount working with NetInfo Manager, but it works for me now. Here's how mine is set up:

In / -> mounts, add a new subdirectory. Name it miles:/share. (That is, its name property should be miles:/share.)

Click on miles:/share and add a new property (Directory -> New Property). Name this property dir and give it the value /Network/Miles_Share (or /Network/Whatever; this is what the mount point will be named). Do this twice more for opts and vfstype properties. When you're done, the properties should look like this:

name -> miles:/share
dir -> /Network/Miles_Share
opts -> url==cifs://nobody:@miles/share
vfstype -> url

Now open a Terminal and check /etc/hostconfig. There should be a line in it which reads:


If there isn't, of if it reads -NO-, add or fix it, and save the file.

Now reboot. You can probably get away with not rebooting, and starting any stopped services by hand, and such, but rebooting's simplest. When it comes back up, see if there's a new directory in /Network. If so, browsing to it should automatically mount it from the server. If not, I don't know what to say. That's what works for me. You might try using url==cifs://nobody:nobody@miles/share for the opts property, if leaving the password blank doesn't work.
posted by hades at 8:21 PM on January 2, 2007

The benefit of doing it with automount through NetInfo Manager is that it should automatically re-mount itself if it gets unmounted, unlike a startup or login script. In practice, this doesn't always work and sometimes I have to run the command:

sudo killall -HUP automount
posted by hades at 8:25 PM on January 2, 2007

A different approach: is there any chance you can make your SMB shares be AFP shares?

I have a linux server supporting my powerbook, and by far the best I've had with network has been when i used atalkd to provide them instead of samba.

I have shortcuts to folders within that share, and if it happens to get unmounted and I click on one of them, it just mounts. No password prompt. It's nice.
posted by flaterik at 8:33 PM on January 2, 2007

Wow, I'd forgotten about the nidump/niload trick. That's much easier than using netinfo manager. Try these commands, from the terminal:
nidump fstab . > /tmp/fstab
echo "miles:/share /Network/Miles url url==cifs://nobody:@miles/share 0 0" >> /tmp/fstab
sudo niload fstab . < /tmp/fstab
sudo killall -HUP automount
If automount is running (which is should be if it's got a -YES- in /etc/hostconfig), that should do the trick, putting the automounted directory in /Network/Miles
posted by hades at 8:45 PM on January 2, 2007

Ok, reporting back....

It looks like I did my step 3 (what majick says, only without the startup thing). However, I use the network drive so often that at the beginning of the day, I often open up one of the shortcuts, causing the drive to be mounted. Adding to startup items should be fine - and remember that once login stuff is saved, it will automount if you access any shortcuts to it.
posted by niles at 8:04 PM on January 3, 2007

Be really, for the love of all that is a graphical interface, please don't use those scripts. I mean, it's nice and all - but it's built in.
My 2ยข.

posted by niles at 8:06 PM on January 3, 2007

« Older Job Search Tracker: If It Is a CRM, am I the...   |   She supposedly looks the most like me of all my... Newer »
This thread is closed to new comments.