7

I have been trying to achieve smb drive automounting on OS Sierra but I am unable to do it properly.

I hacked /etc/fstab which seems to work on this OS to the point that I am unable to force it to change ownership or chmod so other users than root can access it.

I seems that automount is ignoring all my attempts to set uid or gid for the mount and its always mounted as root:wheel.

I went through several threads that deal with that and found no solution anywhere so I tried using Automator with Applescript, where I used a command to Finder app that mounted drive for me, but it always asks for credentials so it's no use for me either.

Can anyone please provide working solution that mounts smb drive on OSx that's accessible for other users than root and works in headless mode (so it does not require any user to log in?)

Thanks

Martin Macak
  • 171
  • 1
  • 1
  • 3
  • I'm trying to do the very same thing. Commenting so I can find this question again. – bmauter Oct 18 '16 at 14:57
  • Have you seen this thread? https://discussions.apple.com/thread/7681623?start=0&tstart=0 TL;DR, this is by design according to someone who contacted Apple – user183733 Nov 02 '16 at 08:55

2 Answers2

3

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.

  • the primary issue with using the >System Preferences>Users>Login Elements option is that in Sierra, Apple has apparently broken the keychain link, so quite often it requires a user to be present for a manual password entry. – frank ankersly May 16 '18 at 13:34
  • I use this method and my mount list (what the command "mount" lists) increases endlessly. Do you observe this? See: https://apple.stackexchange.com/questions/382999/mount-list-grows-endlessly-on-automount-autofs-setup – M. Rubio-Roy Mar 06 '20 at 13:13
  • @M.Rubio-Roy yes, it happened to me as well with macOS Catalina. I disabled the automount and switched to ConnectMeNow. It seems to work fine, And I even get the drive icon in finder, finally! – Michele Dall'Agata Mar 07 '20 at 17:35
  • @MicheleDall'Agata I've found a solution to this endless mount list issue: https://apple.stackexchange.com/a/394605/158948 Everything works great now with autofs. – M. Rubio-Roy Jun 24 '20 at 11:17
  • @M.Rubio-Roy Ok, thanks! I moved to ConnectMeNow anyhow. Still it's good to know! – Michele Dall'Agata Jul 13 '20 at 09:09
3

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.