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

still happens on Beta 3. I have deleted the Login-Data from Keychain and added these again. When i reboot the Mac, i must manually click to connect. Any ideas, why the stored Username/Password is filled, but the volumes not autmatic connect?

What does your script look like? If it is by chance a bash script, then I might know your problem. I too have a bash script set as a login item that mounts my network drive, but doesn't work as of sierra.

This is my script, saved as application:



tell application "Finder"

try

mount volume "afp://nas.box/SHARE1" as user name "USERNAME"

mount volume "afp://nas.box/SHARE2" as user name "USERNAME"

mount volume "smb://pi:PASSWORD@raspi3.local/RasPi3/"

end try

end tell



tell application "Dropbox"

activate

end tell

For what it is worth, I have exactly the same problem in Sierra dev beta 7 (16A304a). My script looks like this:


mount volume "afp://BMK-rnp (AFP)._afpovertcp._tcp.local/Data"


This works fine from my OSX El capitan machines, but not my macOS Sierra machines. It comes up asking to confirm username and password, eventhough I have asked it to be saved in Keychain. Also, I blew away my Login Keychain, and it is still a problem.

Same problem here in dev preview 7. My script essentially does the same thing - mounts a series of NAS shares but on my macbooks it runs a loop that checks for a specific wifi SSID and only tries to connect the shares when that wifi is present. It's always running in the background at startup and it's so quiet I forget about it. It's been working great since Mavericks but now asks to confirm (user name and password already filled) every time I boot up the mac pros or open the macbook lids.


The real problem for me is that I have a different version of the script running at startup on a group of headless mac pros. Now I have to remote into each one and click a few times (once for each NAS) and remember to do this each and every time they boot up.


Here's the macbook version of the script:


repeat


set WifiCHECK to "WIFI_SSID"

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

if theList contains WifiCHECK then


set serverAddress1 to "smb://USERNAME:PASSWORD@IP_ADDRESS/SHARE_FOLDER1"

set serverVolume1 to "SHARED_FOLDER1"

tell application "Finder"

try

if disk serverVolume1 exists then

else

with timeout of 3 seconds

mount volume serverAddress1

end timeout

end if

end try

end tell


set serverAddress2 to "smb://USERNAME:PASSWORD@IP_ADDRESS/SHARE_FOLDER2"

set serverVolume2 to "SHARE_FOLDER2"

tell application "Finder"

try

if disk serverVolume2 exists then

else

with timeout of 3 seconds

mount volume serverAddress2

end timeout

end if

end try

end tell


end if


delay 10


end repeat

This was NOT fixed in the GM version. I have filed bug-reports, I have reported this everever I can, and I see I am not alone. Can someone please find a fix, and can Apple please take this seriously...

A workaround is to mount the smb shares to a folder in your home directory.


Apple Script / Shell Script:


do shell script "[ ! -d ~/MyNASVolumes/share-to-mount ] && mkdir -p ~/MyNASVolumes/share-to-mount || echo directoryOK"
do shell script "mount -t smbfs //NAS-user:NAS-user-password@myNASServer/share-to-mount ~/MyNASVolumes/share-to-mount"

That's not really a workaround for us. We only have AFP sharing enabled on the NASes, and I would literally have to change this hundreds of places.


Apple has to make AFP credentials work, as supposed to us having to play catchup all the time.

Yup, not fixed in the golden master. I've confirmed the issue on a MacBook Pro and an iMac. You said you've reported it. Is there a link where we can up-vote the problem report to incent Apple to fix it quickly?

Add me to the list of people having the same issue. MacOS Sierra GM.


I did exacly what you lot have done - wiping my keychains in their entirety on both machines that I have automount scripts running. No dice, of course.


Terribly annoying.

I use AutomountMaker, which is a great program to mount you shares, but experience the same problem. I get the popup “Enter your name and password for the server….” every time. Name and Password are fortunately pre-filled and although I check “Remember this password in my keychain”, I get the popup every time I mount my shares, although it is stored in my keychain. Already filed a bug report and hopefully it will be resolved soon...

Same problem since beta 1 and now in GM 😟

I used all sierra Beta and they all worked for me (in fact it work since many OS ago, but before, MacOS X server had better option to allow this)

Once the drive is on the desktop, i drop it into my account in User and Group -> Login items

that is it, no script, all my network drives just mount every time I open my account

I'm doing the same as you, and have been since I first started using OS X in 2002.


However, in Sierra I am prompted for a username/password for my shares with the fields pre-populated — just like the other posters. They seem to be using scripts, but I think the underlying problem is identical.

I have the same problem but a work around for me is create another program that just hits the enter key for me when the other is started i know its not practical but its all I got right now i would have done it in the one program but idk how to create 2 threads because a script goes line by line so by trying to have the enter key after mount drive wont work because its waiting for mount drive to finish!


set IP_Valid to true

set networkName to "NETGEAR78-5G"

set IP_address to "192.168.1.***"

set val to true

set SSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk '/ SSID: / {print $2}'"

try

--check if address can ping

do shell script ("ping -c 2 " & IP_address)

on error

set IP_Valid to false

set val to false

end try

--check if your network exists

if SSID is not networkName then

tell application "EnterKey" to quit

end if

tell application "System Events"

try

delay 3

key code 76 -- enter key

set val to false


on error

--display dialog "NO ENTER with icon stop

end try

end tell

if val = false then

tell application "EnterKey" to quit

end if