Automount smb drive on OSX
This works for me on macOS High Sierra:
- Open Finder and press Command-K
- Select your SMB share (I type "smb://NAS326/Storage" where NAS326 is an alias to the NAS IP address and Storage is the shared folder)
That mounts the SMB share and shows it in the desktop
- Open System Preferences
- Click on Users & groups
- Select Login Elements
- Drag&Drop the SMB share icon from desktop
- Click on the box to hide it (should avoid to open a Finder window at each login)
Otherwise I could use the auto_master. I added this entry in /etc/auto_master (you need root access):
# Network Shares
/- auto_smb -nosuid,noowners
And then I created /etc/auto_smb:
/../Volumes/Storage -fstype=smbfs,soft,noowners,noatime,nosuid smb://admin:password@NAS326/Storage
admin is the user allowed to read/write in my NAS and "password" is the password.
Also please note that the "soft" option is quite important. In case the resource is not available (network down or else) without it something in the OS may get stuck trying to connect to the resource.
Assuming that one is dealing with either OSX Sierra or High Sierra (10.12 or 10.13), the automount problems created by Apple's locking of /Volumes are many..
Here is a work-around (created by Apple folks) which essentially 'duct-tapes' a way thru it. https://support.apple.com/en-us/HT207112
TLDR version:
1. you must be 10.12.2 or higher (we recommend 10.12.6 as the only usable version of this pile of horse 'stuff').
2 run this in terminal: sudo defaults write /Library/Preferences/com.apple.NetworkAuthorization AllowUnknownServers -bool YES
NOW: the auto-connection option (>Sys Prefs>Users>Login Elements) will interact properly with keychain and will save your login info properly.