How to automount SMB shared network drives in Mac OS X Lion

Here's how can automount a network drive

  1. Connect to your network drive (finder > go > connect to server)

  2. Enter the credentials for your login to your network drive and tick the ‘remember in keychain’

  3. Open system settings > users > login items

  4. Drag the icon for your network drive from your desktop to the startup items.

Source: This article


sudo bash
mkdir -p /Volumes/Network/Video /Volumes/Network/Audio /Volumes/Network/Public
vi /etc/fstab

Add something like the following (1 mount per line)

192.168.0.200:/video /Volumes/Network/Video url automounted,url==smb://user:[email protected]/video 0 0
192.168.0.200:/music /Volumes/Network/Audio url automounted,url==smb://user:[email protected]/music 0 0
192.168.0.200:/public /Volumes/Network/Public url automounted,url==smb://[email protected]/public 0 0 # there is no password required for this share, just username

run automount -vc

bash-3.2# automount -vc
automount: /net updated
automount: /home updated
automount: /Volumes/Network/Audio mounted
automount: /Volumes/Network/Watch mounted
automount: /Volumes/Network/Video mounted
automount: /Volumes/Network/Public mounted

Get out of the sudo session. Browse in finder to /Volumes/Network - whenever you go there they will now just automount. Just tried this in 10.7.3 and it works fine.

If you get an authentication error like the below, it is likely that the login/password combination entered into /etc/fstab is incorrect. Make sure to rerun automount after correcting the password.

$ sudo automount -vc
automount: /net updated
automount: /home updated
automount: /Volumes/Network/Computing updated
automount: no unmounts
$ sudo ls -l /Volumes/Network/Computing/
ls: : Authentication error

Note that there is no hard requirement that the target mount point be under /Volumes/Network; you can make the target mount point be /foo, and it will be created for you upon demand.


Use AppleScript:

In the AppleScript editor enter this:

tell application "Finder"

try

mount volume "cifs://server/share"

end try

end tell

The save the script as an application. Add to your Login StartUp items


You can auto mount a share by dragging the mounted volume to your "Login Items" in User Accounts. That's how I do it and it's worked since 10.5.

Once caveat re SMB shares, is that with Lion the share will take about 30 seconds to mount at startup... this delay is new since Apple replaced SAMBA with their in-house implementation in Lion.