Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to automatically mount a certain SMB share whenever I log into my account on Snow Leopard. Way back in the Old Days on Mac Classic, all I had to do was Get Info on the drive in question and choose Mount at Startup, but Snow Leopard appears to lack an equivalent option. While I've found some hacks that claim to mount the drive at system boot, (1) they don't work, and (2) they don't do what I want: I want it automatically mounted when I log in and unmounted when I log out, not mounted at system boot.

Is there any built-in way to do this? Or should I go the AppleScript route? If the latter route, does that imply that there is no way to automate this across a network situation?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

Could you just add the following command to your startup items?

mount -t smbfs //user@server/sharename share

Specifically, I'd put it in an Applescript like this:

do shell script "mount -t smbfs //user@server/sharename share"

Then I'd save the file as an application and add it to my login items.

share|improve this answer
    
Oh, and you might have to escape the forward slashes; I can't remember, and I can't test it since I don't have my Mac in front of me at the moment! –  jrc03c Jul 19 '10 at 16:02
    
I have two possible concerns with that: it won't unmount when I log out, unless I'm missing something; and it'll fail if it's already mounted due to not logging out. Is there an easy way to prevent those two issues? –  Benjamin Pollack Jul 19 '10 at 16:49
    
Again, I don't have my Mac in front of me, so I can't confirm this; but I would think that logging out forces network shares to unmount automatically. Or perhaps they'll only stay mounted by your username (in other words, if another user logs in after you, they can't access the share). Can you confirm this? –  jrc03c Jul 19 '10 at 17:42

finder -> go -> connect to server: enter the smb URL when asked, save credentials to keychain

finder -> preferences: check "connected servers" under "show these items on the desktop"

Open system preferences -> accounts -> login items: drag the icon into the login items

share|improve this answer

Mount the volume you want. Then, just drag the volume into Login Items inside System Preferences / Users & Groups / (your account). Make sure the credentials you need to connect are stored in your keychain.

You should see it appear as another Login Item, of type "Folder". That's it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.