Automount A SMB Drive In OSX

Posted By Weston Ganger

I wanted my SMB share to automount on my Macbook running OSX Yosemite.

It should have been easier than this to set this up but its a Mac.

First create a shares directory somewhere underneath your home folder. I had endless permissions troubles when placing it elsewhere.

mkdir ~/shares

Next edit /etc/auto_master

# /etc/auto_master

## Automounter master map
+auto_master # Use directory service
/net -hosts        -nobrowse,hidefromfinder,nosuid
/home auto_home    -nobrowse,hidefromfinder
/Network/Servers   -fstab

# Insert this line
/Users/my_username/shares auto_smb # WARNING: Whatever folder you choose here will be completely overwritten

/-                 -static 

Now we need to setup the auto_smb script. Create a new file at /etc/auto_smb

# /etc/auto_smb

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

Lastly set the permission & reload.

# Set scripts permissions
sudo chmod 600 /etc/auto_smb

# Reload auto_master config
sudo automount -vc

Related External Links:

Article Topic:Software Development - OSX

Date:May 05, 2016