Saturday, October 18, 2014

OSX Yosemite Automount NAS Share

Saturday, October 18, 2014 Posted by Unknown
On my fresh installed Yosemite on my Macbook Air I want a mounted folder in my homedir when I am at home near my NAS. When I'm not at home it must not bother me with the none existing share. And when I'm back home it must silently reconnect.

This can be done by using autofs.

edit the file /etc/auto_master

## Automounter master map
+auto_master # Use directory service
/net -hosts -nobrowse,hidefromfinder,nosuid
/home auto_home -nobrowse,hidefromfinder
/Network/Servers -fstab
/Users/broersa/Documents/Shares auto_resources
/- -static 

The line starting with /Users is added. This will automount on the path selected. It will pick the resources from auto_resources. This is a new file we have to create:

all -fstype=smbfs ://username:password@ 

This will automount the share all on the path /Users/broersa/Documents/Shares/all

do a "chmod 600 auto_resources" to protect the username password from other users then root.

reload the config.

automount -vc

Don't forget to do everything as sudo.

Now you have your share always available when in range.