macOS Sierra Automount on Startup

I have a little Script as Startup-Object:

https://picload.org/image/rrrpioli/bildschirmfoto2016-07-06um17.3.png


In this Script 2 Shares from my NAS (nas.box) and a Raspberry Pi (Raspi3) should mounted on Startup. This worked with El Capitan without problems. Since macOS Sierra Beta 1 the Script loads and mounting starts after startup but asks for my Login-Data. Username an Passwords are filled, but i must click on "Connect". For the NAS-Share, the Option to store the Login-Data to Keychain is checked. On the Raspberry-Share it's not checked, but the User-Data are also filled.


https://picload.org/image/rrrpioli/bildschirmfoto2016-07-06um17.3.png


https://picload.org/image/rrrpiolw/bildschirmfoto2016-07-06um17.3.png


The Problem is, that this occours every time, when i reboot my Mac or Logout/Login to my User-Account. I've tried to delete the Objects from Keychain, but it doesent change anything.


Any suggestions?

Accepted Reply

Here is how I am dealing with it.


Go to your home folder ~ and create a folder named Server. Open the newly created Server folder and make another folder named Drive.


Then launch Applescript Editor and create a new script like so:


do shell script "mount_afp afp://user:password@ip_address/Drive ~/Server/Drive"


You will need to enter your particulars here. Example : "mount_afp afp://bob:xyz123@192.168.1.100/bob ~/Server/Drive"


Save your script as an application.


Open System Preferences - User & Groups - Login Items. Drag your script application into the box for automatic login items. Reboot.


Your drive should be on your desktop.


Good luck.

Replies

YES – helped instantly on two devices (10.12.1), same NAS (Synology, fully updated)🙂

Volume appeared at reboot like magic – now it's normality, again…

Wasted time (until reading here, developer account etc) more than eight hours.


Thank you, Apple

Problem finally solved by Apple with OSX 10.12.2

See also the following article to modify the authentication behavior;


https://support.apple.com/en-us/HT207112

You need to drag the folder for the network share into the dock, not the network server.


For example:

1) Connect to your network share (i.e. smb://192.168.1.50/Media)

- Open Finder

- In the menu bar, Go -> Connect to Server

- Type server address and hit Connect

- Provide credentials if prompted (check to remember credentials in keychain)

- Choose share from list to access

2) Open the network server from Finder (on left side under "Shared"). The list of shares for this network will appear on right.

3) Drag the folder for the share you want to the dock on the right side (i.e. next to the Trash)


You should be automatically mounted and connected to the share upon restart. This works like a charm for me. Simple solution!

3D Touch

on macOs 10.12.2 same issue with getting prompted for a username and password even though I added it to my keychain, but changing the mount point worked. I noticed the mounts still show up in /Volumes even though I instructed them to go to /Users/machome/Mounts? Not too sure how it knows they are mounted even though I have it check my new Mount folder?


tell application "Finder"
  if not (disk "/Users/machome/Mounts/views" exists) then
  mount volume "smb://network_machine/viewes
  end if
end tell

How was it solved?

I use a similar script and have encountered the same sort of screwy icons and folder behaviors. Did you find a resolution?

Thanks, R-M-B!


This fixed it for me. In fact, this is what should be marked as the answer now I think, as it's a workaround from Apple themselves finally.

Hi!


I have made a shell script which parses a .plist file and mounts the listed shares. All the needed passwords for these shares are NOT stored in the script but retrieved from the local keychain.

Have a look at https://github.com/gniemetz/automount/blob/master/automount.sh


Hope this helps!


best regards

Gerd

I'm monitoring thes thread closely. It's a real shame that Apple is not making this a priority. Apple is having a huge presence in the enterprise now, yet can't get basic, simple NAS functionality going. It's an embarassment actually.

I finally upgraded my work machine to Sierra a few weeks ago. I was a bit concerned because of threads like this one. But I can confirm that a true automount via autofs still works fine in Sierra. I'm not using a NAS through. I have an Active Directory environment with a Linux SMB server. Do any of these NAS devices support login authentication via Active Directory or Open Directory? Once I'm logged into the network, I can mount SMB shares with no trouble via entries in /etc/auto_master and similar. Clearly, this is the environment that Apple supports. I've never had a NAS so I don't know if they can be configured to provide a real directory service with authentication.

It seems odd. Aren't firewalls and sharing rules supposed to help with this issue?

I can confirm this is working with mount_smbfs as well... (except without -t)


😀

Are you able to help me? I want the exact same functionality you do so I decided to use your script, but every time I try to go and save it as an application using AppleScript, I get a Syntax error Expected "end" but found unknown token.


I'm not a programmer, so am not able to self debug. 😕



All I've been able to do so far is Launch Apple Script Editor and pasted the script following =========== below and tried to hit save. Can you help me understand what I'm doing wrong please?



===========


set NrMounted to 0

set MaxMount to 2 -- max number of networkshares to mount

set NrTries to 0

set MaxTries to 5 -- max tries before quit

repeat while NrMounted is not MaxMount and NrTries is not MaxTries

set theWifi to "VancityGuyWifi" -- the wifi SSID

set theList to paragraphs of (do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s| awk '{print $1}'") -- get the wifi list

set EthernetStatus to do shell script "ifconfig en0 | grep 'status' | cut -d ':' -f 2 | tr -d ' '" -- get ethernet status

if theList contains theWifi or EthernetStatus = "active" then


if MountedSuccessfull("Volume_1") then set NrMounted to NrMounted + 1

if MountedSuccessfull("Volume_2") then set NrMounted to NrMounted + 1



end if

set NrTries to NrTries + 1

delay 10 -- waiting time before next try

end repeat

on MountedSuccessfull(VolumeName)

set NASUserCredentials to "username:password"

set NASIP to "100.100.100.2"

set MountPointFolder to "/Users/Vancityguy/NAS/"


set Mounted to false

set serverAddress to NASUserCredentials & "@" & NASIP & "/" & VolumeName

set mountPoint to MountPointFolder & VolumeName

tell application "Finder"

try

if disk VolumeName exists then -- it's presumable already mounted

else

with timeout of 3 seconds -- try to mount

do shell script "[ ! -d " & mountPoint & " ] && mkdir -p " & mountPoint & " || echo directoryOK" -- create the folder to host the mount point if it doesn't already exist

do shell script "mount -t smbfs /

set Mounted to true

end timeout

end if

end try

end tell

return Mounted

end MountedSuccessfull