Por: Fabio Pampin
Automount smb shares on OSX Yosemite
January 15, 2015
When googling how to do this, I found the tutorial shown above. It’s pretty well explained, although a bit convoluted, the option that actually works for Maverick and above is Option 4.
Option 4 is very similar to Option 1, save that it uses a folder other than “Volumes”. This is the key, as the system will be unable to mount the volume if it can’t find the folder with the correct name, which gets removed when the volume is unmounted.
Here are the steps I followed:
Open the auto_master file…
sudo vim /etc/auto_master
…and add the following line to it
/- auto_smb -nosuid
This basically tells OSX to read the file auto_smb, and the -nosuid parameter prevents OSX from mounting the volume as root readonly
Create/edit the auto_smb file
sudo vim /etc/auto_smb
Create a new folder where the volumes will be mounted
mkdir mnt //In my case, I created a mnt folder in my filesystem's root
And add the following line per volume you want to automount:
[PATH] -fstype=smbfs,soft ://[USERNAME]:[PASSWORD]@[SERVER]/[SHARE]
Where PATH is the absolute path to the LOCAL folder you want to use for that volume
This is the config for our server:
/mnt/documents -fstype=smbfs,soft ://gm2dev:########@10.0.1.20/documents /mnt/compartido -fstype=smbfs,soft ://gm2dev:########@10.0.1.20/compartido
Last of all, run
sudo automount -vc
Create the new folders manually if automount gives you any trouble with them.
[cd]‘ing into the folder should work now, and
[ls -laH] show you the contents from your smb server.
You can create a symbolic link
[ln -s] for the new folders in /Volumes/ in order to let programs access them as they used to (ie, so you don’t have to re-create/re-open all your sublime projects from the new mount point.)
And that’s it! Hope this is useful!