-
Re: macOS Sierra Automount on Startup
Tweak Jul 18, 2016 2:25 PM (in response to Tweak)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?
-
Re: macOS Sierra Automount on Startup
alexk403 Jul 19, 2016 3:51 PM (in response to Tweak)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.
-
Re: macOS Sierra Automount on Startup
Tweak Jul 19, 2016 4:29 PM (in response to alexk403)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
-
Re: macOS Sierra Automount on Startup
KillerBob Aug 24, 2016 6:36 PM (in response to Tweak)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.
-
Re: macOS Sierra Automount on Startup
iMachine Aug 25, 2016 10:32 PM (in response to KillerBob)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
-
Re: macOS Sierra Automount on Startup
KillerBob Sep 10, 2016 5:18 AM (in response to iMachine)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...
-
Re: macOS Sierra Automount on Startup
yobyot Sep 17, 2016 2:20 PM (in response to KillerBob)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?
-
-
Re: macOS Sierra Automount on Startup
SkySpirit Jul 19, 2017 4:55 AM (in response to iMachine)Hello. Can you help me to combine Auto VPN and then mount drive? VPN on idle set vpn_name to "'VPN'" tell application "System Events" set rc to do shell script "scutil --nc status " & vpn_name if rc starts with "Disconnected" then do shell script "scutil --nc start " & vpn_name end if end tell return 10 end idle NAS tell application "Finder" try mount volume "afp://10.0.1.10/Public" mount volume "afp://10.0.1.11/Public" end try end tell return 10 tell application "Finder" activate end tell Thanks
-
-
-
-
-
Re: macOS Sierra Automount on Startup
mkleinb Sep 18, 2016 8:22 AM (in response to Tweak)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...
-
-
Re: macOS Sierra Automount on Startup
Juerg Sep 11, 2016 1:58 PM (in response to Tweak)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"-
Re: macOS Sierra Automount on Startup
KillerBob Sep 11, 2016 4:11 PM (in response to Juerg)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.
-
-
Re: macOS Sierra Automount on Startup
tnaseem Sep 18, 2016 4:34 AM (in response to Tweak)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.
-
Re: macOS Sierra Automount on Startup
nidr0x Sep 20, 2016 12:28 PM (in response to Tweak)Same problem since beta 1 and now in GM
-
Re: macOS Sierra Automount on Startup
Franco Sep 20, 2016 3:07 PM (in response to Tweak)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
-
Re: macOS Sierra Automount on Startup
qahtani Sep 20, 2016 8:30 PM (in response to Franco)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.
-
-
Re: macOS Sierra Automount on Startup
TomBurke Sep 21, 2016 9:34 AM (in response to Tweak)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.xxx"
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
-
Re: macOS Sierra Automount on Startup
arimuras Sep 22, 2016 2:29 AM (in response to Tweak)Still problem. 10.12.1 Beta(16B2327e)
-
Re: macOS Sierra Automount on Startup
cjstout Sep 23, 2016 10:46 AM (in response to arimuras)Confirmed the same. Reported as a bug to Apple. I'll be sure to post any updates if my bug report is acknowledged.
-
-
Re: macOS Sierra Automount on Startup
jospic Sep 22, 2016 3:27 AM (in response to Tweak)Apple have locked down the
/Volumes
folder as confirmed here:https://openradar.appspot.com/radar?id=4948585099558912
There are not workaround....
-j
-
Re: macOS Sierra Automount on Startup
evalenzb Sep 22, 2016 12:06 PM (in response to Tweak)Hi all,
I have the very same problem with actual macOS final release for Sierra, 4 iMac, 3 Macbook, and 2 Mini (for server purposes).
Servers are the most problematics, please Apple help fix it!
-
Re: macOS Sierra Automount on Startup
rene b Sep 24, 2016 5:55 AM (in response to Tweak)Confirmed; same issue here in Sierra 10.12 public release, and also when using the utility "Drive Mounter".
-
Re: macOS Sierra Automount on Startup
biker.2011 Sep 24, 2016 1:26 PM (in response to Tweak)Same Here. Apple is all about Security these days. But this is a feature Apple need to fix. Many business customers will complain about this ****.
-
Re: macOS Sierra Automount on Startup
nidr0x Sep 24, 2016 1:27 PM (in response to biker.2011)Same problem un 10.12.1 Public release beta
-
-
Re: macOS Sierra Automount on Startup
donrico Sep 28, 2016 2:47 PM (in response to Tweak)I have a Synology that goes to sleep at night and normally the mount volume command will do the trick to reconnect the share after my Synology wakes.
Since MacOS sierra it is necessary to click the button connect with the given credentials.I made a temporary solution that will autoconnect the share, but you'll have to make two applescripts.
Script 1: Connect the share
===
tell application "Finder"
try
mount volume "smb://username:password@networklocation/sharename"
end try
end tell
===
Script 2: Hitting the return button
===
tell application "System Events"
keystroke return
end tell
===
After you made the two scripts you have to make 2 calendar items.
Open Calendar and create a new event.
Pull down the menu next to “Alert” and choose “Open File” now choose the first script.
Make a second event (just one minute later) and choose the second script.
Basically the first script will run at the selected time and will be waiting for the return button that will arrive one minute later.This way it's automated again. And you can copy the events to another day. It's not a clean solution but it works for me until Apple comes with a update / solution.
-
Re: macOS Sierra Automount on Startup
Amarand Oct 2, 2016 8:20 AM (in response to Tweak)Having the same issue with 10.12 (16A323). It's super annoying that shares cause a "Connect As" window to pop-up, with pre-populated Name and Password fields, and I have to manually press Connect. This is wreaking havoc with my scripts and backup utilities. Never had this issue with previous versions of the OS.
-
Re: macOS Sierra Automount on Startup
Atarimac Oct 4, 2016 6:20 AM (in response to Tweak)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.
-
Re: macOS Sierra Automount on Startup
albanet78 Oct 4, 2016 12:02 PM (in response to Atarimac)"Hi @Atarimac
I'm a bit of confused. Where should I create the "folder named Server" ? What home are you talking about ? The NAS one or on the mac ?
Excuse my misunderstandment but I'm really annoyed by this new "feature" and I'm absolutely not familiar with developpement.
regards.
-
Re: macOS Sierra Automount on Startup
Atarimac Oct 5, 2016 6:18 AM (in response to albanet78)You create the folder in your home folder of your Mac's hard drive. Double click on your Mac's hard drive. Then double click on users. Click on the icon of a house (your user name should be under the house). Navigate to the menu bar. Choose File. Then New Folder. Name the new folder Server. Double click the new folder named Server. Then navigate to the menu bar. Choose File. Then New Folder. Name the new folder Drive. Close out all of the windows.
-
Re: macOS Sierra Automount on Startup
albanet78 Oct 11, 2016 9:26 AM (in response to Atarimac)HI @atarimac
Thanks for your reply but I can't get it to work.
I've created the folders where you told but I don't understand how it can "find" the NAS shares.
Plus the script returns me a number 2 error.
What credentials and what IP should I write ? The NAS's ones ? or the Mac's one ?
In fact none of the above soutions works for me..
I'm desperate...
Anyway thanks all for all the solutions.
-
Re: macOS Sierra Automount on Startup
Tylast Nov 19, 2016 1:10 AM (in response to albanet78)I get the same error using the mount_afp command. Figure that one out yet?
I also get the following error when trying to use the mount smbfs command as well:
error "usage: mount [-dfruvw] [-o options] [-t external_type] special node mount [-adfruvw] [-t external_type] mount [-dfruvw] special | node" number 1
Any ideas?
-
-
-
-
Re: macOS Sierra Automount on Startup
IMEI Oct 7, 2016 12:37 PM (in response to Atarimac)Thank you for the hint
This works for me -> mount -t afp afp://user:pass@192.168.1.100/Data ~/Server/Drive
-
Re: macOS Sierra Automount on Startup
albanet78 Oct 12, 2016 6:15 AM (in response to Atarimac)Finally I got it working with your solution!
After re-reading the whole thread 2 times, I now understand how it's supposed to work!
So I'll answer myself and explain it for people like me :
I did create those two folders like you said 3server" and "Drive" and I wrote exactly this script :
do shell script "mount_afp afp://NASusername:NASpassword@NASIPadress/NAMEoftheVolumeinNAS ~/Server/Drive"
As i Have several volumes in my NAS, I struggleded a little more when I had the idea to launch my originial mounting script and it now works perfectly !!
So to be clear, i launch the first script as a Sierra credential and the second as it was already to mount all my drives (10 in my case).
A huge thanks to everyone over here !!
alban
-
Re: macOS Sierra Automount on Startup
TECreasey Nov 2, 2016 9:11 AM (in response to Atarimac)Thank you so much for this solution. I have been trying to find a perfect solution to mounting a network drive at login and this is the best one yet. I have been so frustrated having to enter the same username and password over and over. For some reason it never remembered my credentials and now it does.
Thank you.
-
Re: macOS Sierra Automount on Startup
DerRudi Nov 4, 2016 2:06 AM (in response to Atarimac)Yes I can confirm this works... you have to use the IP adres of the shares... not the existing links you have been using so far...
-
Re: macOS Sierra Automount on Startup
ppoisson Jan 18, 2017 7:02 AM (in response to Atarimac)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
-
-
Re: macOS Sierra Automount on Startup
ticky Oct 4, 2016 6:38 AM (in response to Tweak)I am using the Users & Group Login Items built-in function to automatically mount a drive on startup and I am having this issue above. It seems unreasonable that Apple would change the security settings to prevent mounting by its own system.
-
Re: macOS Sierra Automount on Startup
Atarimac Oct 4, 2016 7:48 AM (in response to ticky)Try my solution above. It is a bit of a kludge, but it works.
-
-
Re: macOS Sierra Automount on Startup
Raka74 Oct 5, 2016 4:45 AM (in response to Tweak)I dealt with it completely
Restore from Time Capsule backup - back to El Capitan.
I want my Mac mini to mount some (media) folders on my NAS on boot, I have mountwatcher installed and I dont want to use any srcipt to press 'Enter'
-
Re: macOS Sierra Automount on Startup
Atarimac Oct 5, 2016 5:59 AM (in response to Raka74)If you use my above solution, you do not need to press enter nor script pressing enter. Everything just works. The mount location is moved, but that is seamless to your workflow.
Instead of the mount point being in /Volumes it is located in your home folder.
-
-
Re: macOS Sierra Automount on Startup
iMachine Oct 6, 2016 2:21 AM (in response to Tweak)Okay, I think I have a solution to this that will work for me at least.
I wasn't interested in mounting the network shares to a user folder instead of inside the default /Volumes folder.
I tried adding a symbolic link to the /Volumes folder to a new location where the network shares would be mounted but that symbolic link is deleted on reboot.
But then I thought after reading some of the advice here: What if I have a volume on the local drive called "Network_Shares" or "Network_Storage" that I mount all the shares inside? This "Network_Storage" volume would then live inside the /Volumes folder and the shares would live inside it....keeps it nice and clean and easy to access.
Here's what I did to work around this issue:
Opened up disk utility and added a small partition (100MB) but it can be much smaller.
This partition will only serve as the root level for mounting network volumes is is automatically mounted every time the mac boots up.
Then I altered my applescript I originally posted near the top of this thread to read as follows:
--
--
--
--
--
--this first part is for my macbook only so it doesn't attempt to mount the shares unless I'm at the location where the wifi SSID is broadcast
set theWifi to "MySSID" -- 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
if theList contains theWifi then
set serverAddress1 to "UserName:Password@Server-Address/Share_Name1"
set serverVolume1 to "Share_Name1"
set mountPoint1 to "/Volumes/Network_Storage/Share_Name1"
-- the line above might also be changed to set mountPoint1 to "Volumes/Network_Storage/" & serverVolume1
tell application "Finder"
try
if disk serverVolume1 exists then -- do attempt anything since it's presumable already mounted
else
with timeout of 3 seconds
do shell script "[ ! -d " & mountPoint1 & " ] && mkdir -p " & mountPoint1 & " || echo directoryOK" -- create the folder to host the mount point if it doesn't already exist
do shell script "mount -t smbfs //" & serverAddress1 & " " & mountPoint1
end timeout
end if
end try
end tell
set serverAddress2 to "UserName:Password@Server-Address/Share_Name2"
set serverVolume2 to "Share_Name2"
set mountPoint2 to "/Volumes/Network_Storage/Share_Name2"
tell application "Finder"
try
if disk serverVolume2 exists then -- do attempt anything since it's presumable already mounted
else
with timeout of 3 seconds
do shell script "[ ! -d " & mountPoint2 & " ] && mkdir -p " & mountPoint2 & " || echo directoryOK"
do shell script "mount -t smbfs //" & serverAddress2 & " " & mountPoint2
end timeout
end if
end try
end tell
end if
display alert "**** on this Apple!"
delay 10 -- check for drops every 10 seconds, may not need this anymore as it was added back in Mavericks, it's an enless loop so if you unmount a volume it will mount back within 10 seconds
end repeat
-
Re: macOS Sierra Automount on Startup
DDu-Alvin Oct 9, 2016 12:31 AM (in response to iMachine)Hi,
I tyied 2 mthods
1. Mount the net disk under /Users/user/mountpoint
2. Create a new partition and mount net disk under /Volumes/newpartion/mountpoint
Both methods could mount the net disk properly, but I still face some access issues.
When I was trying to copy a movie from mounted net disk, it shows "I cannot copy the file, you do not have the read access"
Anyone got the same problem?
Thanks
===============================
Sorry about that, got the problem, something wrong with my net disk NTFS Security Settings~
I reset the disk security access, took the ownership access with current user.
-
Re: macOS Sierra Automount on Startup
tod1212 Oct 10, 2016 1:21 AM (in response to DDu-Alvin)The problem is fixed for me. Automount works again.
Here is what I did:
- deleted the old shared volume item in user startup items.
- deleted any entrys regarding the NAS (Synology) in the keychain.
PLUS:
- installed the latest cricial update for my Synology NAS (6.0.2 update 2)
Then:
restart Mac, connect to shared volume in finder with cmd+k, drag connected share into user startup items.
-> automount works again.
-
-
Re: macOS Sierra Automount on Startup
tpas Oct 18, 2016 1:55 AM (in response to iMachine)Thanks man! I used your script and altered it a little. Now I finally have a working automount on my NAS shares!
I changed your script, because of a few reasons:
1. It goes on eternally and on shutdown of my Mac, it prevents the shutdown (I created an app out of the script). I only want to run it on boot, so no eternal run necessary. So I added a maximum number of tries (in my case set to 5)
2. It doesn't mount when I plug in my ethernet cable with a shutdown wifi. I want it to mount also over the ethernet, so I added this check
3. I cleaned it up a little, using a little more variables and a function call
Here's my script:
set NrMounted to 0
set MaxMount to 4 -- 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 "********** Fill in your Wifi SSID here *******************" -- 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("****** fill in the name of your first share here *************") then set NrMounted to NrMounted + 1
if MountedSuccessfull("****** fill in the name of your second share here *************") then set NrMounted to NrMounted + 1
if MountedSuccessfull("****** fill in the name of your third share here *************") then set NrMounted to NrMounted + 1
if MountedSuccessfull("****** fill in the name of your fourth share here *************") 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 "****************** fill in your usercredentials on your NAS shares here. In the form: user:password ******************"
set NASIP to "***************** fill in the IP of your NAS here. for example: 19.168.1.112"
set MountPointFolder to "******************** fill in the place where to mount on your Mac here. for example: /Users/yourname/NAS/ (don't forget the last '/') ****** "
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
-
Re: macOS Sierra Automount on Startup
vancityguy Apr 6, 2017 10:19 PM (in response to tpas)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
-
-
-
Re: macOS Sierra Automount on Startup
andrewha Oct 9, 2016 11:46 AM (in response to Tweak)Try this for auto mounting your SMB / AFP / NFS volumes: https://itunes.apple.com/us/app/automounter/id1160435653?ls=1&mt=12
I ran into the same problem, so I developed around it.
-
Re: macOS Sierra Automount on Startup
KillerBob Oct 11, 2016 12:30 PM (in response to andrewha)Andrew,
I bought your Automounter app, but must admit I am a bit dissapointed... I can't use the NAS name as defined in the settings on the NAS???
My NAS is named "BMK-rnp", and that name works in Apple scripts, and in Finder the NAS shows up as "BMK-rnp (AFP)". However, I can't use it in your Automounter app, and only if I use the IP address does it work. I do not want to use the IP address, because then I have to rescan all my apps that have links to files on the NAS. Hence it is not feasible for me.
-
Re: macOS Sierra Automount on Startup
3mk4i Oct 14, 2016 5:07 PM (in response to andrewha)@andrewha I created a developer forum account just to say thank you! I bookmarked the Automount post you presumably did on Lime Tech & I've been using the scripts & instructions for a few years now on various macs. Discovered this post when looking into having to fix the issue (I check the Lime Tech post a few days ago but it's old so didn't expect an update). Downloaded your app, it works great... Then went back to the Lime Tech (to find the lcoations to remove the launch files) & saw your update! So, thanks for the scripts & especially the new app!
To all others, I'd advise getting this app, it's definitely the best way of creating these mounts...
-
-
Re: macOS Sierra Automount on Startup
cokyq Oct 11, 2016 2:10 PM (in response to Tweak)I also have a similar problem. In El Capitan, the following applecript mounted my Synology disktation NAS volumes. Now in Sierra, it fails to find my diskstation drives (does not exist or is not available) and then gives an error -5016.
tell application "Finder"
mount volume "smb://DiskStation/Volume1/Video" as user name "Ralph Quinones"
mount volume "smb://Diskstation/Volume1/Music" as user name "Ralph Quinones"
mount volume "smb://Diskstation/Volume1/Photos" as user name "Ralph Quinones"
mount volume "smb://Diskstation/Volume1/Downloads" as user name "Ralph Quinones"
mount volume "smb://Diskstation/Volume1/Documents" as user name "Ralph Quinones"
end tell
I am not a programmer and was able to build this a few years ago by googling it. Now I am trying to find help on how to rewrite the script so it works and mount my NAS drives whenever my MAC boots. If I try to do this in user/login in preferences, only 2 drives mount. Never been able to make all 5 mount from user login preferences.
Any ideas how to rewrite the mount volume so it works? I remarked my original mount volume statements, and used the following line:
mount volume "afp://192.168.1.41"
This does not crash the apple script. It prompts me to enter my password, then I can select the drives I want to mount, and it it works. Does anyone know how to automate loading all 5 drives without having to authenticate and select the volumes?
Thanks in advance for your help.
-
Re: macOS Sierra Automount on Startup
DDu-Alvin Oct 12, 2016 12:07 AM (in response to cokyq)mount volume "smb://DiskStation/Volume1/Video" as user name "Ralph Quinones"
code above will mount volume into /Volumes folder by default, since macOS Sierre has changed the /Volumes folder privilege, so one of the solution is to mount the volume to a mount point within home folder;
mkdir -p ~/DiskStation/Video mount -t smbfs smb://YourUserName:YourPassword@DiskStation/Volume1/Video ~/DiskStation/Video
Hope it helps~
-
Re: macOS Sierra Automount on Startup
michno Oct 31, 2016 3:00 AM (in response to DDu-Alvin)But what would the command be to unmount that same volume? I need to mount it (works), do something and then unmount it again, all scripted.
Many thanks in advance!
-
-
Re: macOS Sierra Automount on Startup
sakman74 Oct 22, 2016 10:53 AM (in response to cokyq)very interesting that Apple has not bothered to fix this constant authentication prompting as of yet ? or have they done so in the latest sierra beta 5 ?
-
-
Re: macOS Sierra Automount on Startup
Alfa-Male Oct 24, 2016 1:55 PM (in response to Tweak)So this is quite interesting, not only because lots of people are having the same issue as I found, but also that there are so many ways to mount a network share in macOS! Amazes me that people have been complaining about how awkward it is compared to Windows yet we still don't have a simple method to do this.
Anyway, I digress; I have a simple shell script that also stopped working with Sierra and I found the same workaround of mounting to my home folder to work, however I'm finding that after waking the mac from standby all the network drive icons have changed to the standard HDD icon and all of them are named "Macintosh HD". They're completely empty if I open any of then and they cannot be ejected. If I re-run the script then the spurious drives disappear and the normal network drives re-appear. Definitely didn't have this on any OS until Sierra.
Anyone else had this? Script below for reference, it's not pretty but it works!
#! /bin/sh if [ ! -d ~/Mounts/itunes ] then mkdir ~/Mounts/itunes fi if [ ! -d ~/Mounts/Software ] then mkdir ~/Mounts/Software fi if [ ! -d ~/Mounts/Photos ] then mkdir ~/Mounts/Photos fi if [ ! -d ~/Mounts/Movies ] then mkdir ~/Mounts/Movies fi if [ ! -d ~/Mounts/Household ] then mkdir ~/Mounts/Household fi if [ ! -d ~/Mounts/NAS_Home ] then mkdir ~/Mounts/NAS_Home fi if [ ! -d ~/Mounts/Dropbox ] then mkdir ~/Mounts/Dropbox fi if [ ! -d ~/Mounts/Lightroom ] then mkdir ~/Mounts/Lightroom fi mount_afp afp://username:password@10.0.0.3/Music ~/Mounts/itunes mount_afp afp://username:password@10.0.0.3/Public/Software ~/Mounts/Software mount_afp afp://username:password@10.0.0.3/Photos ~/Mounts/Photos mount_afp afp://username:password@10.0.0.3/Videos ~/Mounts/Movies mount_afp afp://username:password@10.0.0.3/Public/Household ~/Mounts/Household mount_afp afp://username:password@10.0.0.3/homes/username ~/Mounts/NAS_Home mount_afp afp://username:password@10.0.0.3/homes/admin/Dropbox ~/Mounts/Dropbox osascript -e 'tell application "Terminal" to if not ((count windows) > 1) then quit'
-
Re: macOS Sierra Automount on Startup
mareich49 Jan 23, 2017 2:24 PM (in response to Alfa-Male)I use a similar script and have encountered the same sort of screwy icons and folder behaviors. Did you find a resolution?
-
-
Re: macOS Sierra Automount on Startup
Julieanne Oct 24, 2016 6:30 PM (in response to Tweak)Hi
I'm new to apple, but have a rudmentary programming background, and I'm trying to get the script to work with no joy ..
I have created the following script but nothing happens when I run it - other than the running icon for 50 seconds?
Is there anything else I need to set in the apple environment for it to run - I have a Macbook air 2014
Presumably it should create, and I should see, mount points in the named directory
set NrMounted to 0
set MaxMount to 4 -- 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 "T******" -- 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("Music") then set NrMounted to NrMounted + 1
if MountedSuccessfull("TV Series") then set NrMounted to NrMounted + 1
if MountedSuccessfull("New") then set NrMounted to NrMounted + 1
if MountedSuccessfull("Videos") 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 "Media:password"
set NASIP to "Office-PC"
set MountPointFolder to "/Users/julieanne/Media/" -- I have created this directory in Finder
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 presumably 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 //" & serverAddress & " " & mountPoint set Mounted to true
end timeout
end if
end try
end tell
return Mounted
end MountedSuccessfull
-
Re: macOS Sierra Automount on Startup
hubionmac Oct 26, 2016 3:11 PM (in response to Tweak)I played around with that and it is just a setting issue inside the keychain. For a saved login you set the privilidges for direct access per program. So if you just add the Finder to the list of programs that may access the specific keychain entry without asking you it should work.
Same for Applescript, when you want to mount a share via Script. You just add the Finder (/System/Library/CoreServices/Finder.app) to the trusted apps for a login and in your AppleScript you just make sure that the mount-command is wrapped in an tell app "Finder"-statement
Maybe that screenshot explains better what I mean ;-)
https://www.apfeltalk.de/community/attachments/bildschirmfoto-2016-10-27-um-00-00-23-png.138953/
-
Re: macOS Sierra Automount on Startup
renglm_ Dec 4, 2016 11:18 AM (in response to hubionmac)Sounds very reasonable – but doesn't change the situation under Sierra (clickable mount-dialog appears).
-
-
Re: macOS Sierra Automount on Startup
danielstonehouse Oct 27, 2016 7:27 PM (in response to Tweak)I've solved this in a kludgy way - with an applescript that ensures the login window has focus, and sends an enter keypress to the login window.
Save applescript as an application and at to your login items in Users and Groups under System preferences. Adjust the delay to suit
delay 5
tell application "System Events" to tell process "NetAuthAgent" to perform action "AXRaise" of window 1
tell application "System Events" to key code 36
You will need to add the application containing the script to the accessability list under System Preferences / Security and Privacy to grant it access to control your computer
-
Re: macOS Sierra Automount on Startup
aktivomat Oct 30, 2016 5:22 AM (in response to Tweak)I found a very simple solution for this problem by chance. I just put the server icon (keychain must be saved before) to my dock menu (on the right side). So all servers attached to the dock (keychains saved) will automount without any password confirmation.
-
Re: macOS Sierra Automount on Startup
michaelfinleysummers Oct 30, 2016 7:41 AM (in response to aktivomat)Wow! This worked -- and so easy!
-
Re: macOS Sierra Automount on Startup
VAMark Nov 18, 2016 7:13 AM (in response to aktivomat)How do you add the server icon to the dock menu (what are the steps to do this)…maybe I'm making this more complicated that it is?
-
Re: macOS Sierra Automount on Startup
JoseCRamirez Dec 1, 2016 3:10 PM (in response to VAMark)Open a Finder window, click on a network share (icons on the left).
Right-click on the Finder window title (over the name of the network share) and click below it on 'Network' (this is the parent folder, containing all network servers).
Now you have the server icon, which you can drag to your dock.
At least for me, this trick does not avoid the system asking for credentials for the first time! But it speeds up greatly the server discovery & connection to shares. Thanks!
-
Re: macOS Sierra Automount on Startup
RealDealNeil Dec 27, 2016 1:26 PM (in response to VAMark)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!
-
-
Re: macOS Sierra Automount on Startup
renglm_ Dec 4, 2016 11:23 AM (in response to aktivomat)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
-
-
Re: macOS Sierra Automount on Startup
hwoltering Nov 7, 2016 8:57 AM (in response to Tweak)But to anyone experiencing this issue, I do not really mind the password question, however the first drive I try to mount via the script gets duplicated under "volumes".
My script:
tell application "Finder" try mount volume "afp://TS431(AFP)._afpovertcp._tcp.local/Documents" mount volume "afp://TS431(AFP)._afpovertcp._tcp.local/Music" mount volume "afp://TS431(AFP)._afpovertcp._tcp.local/Video" mount volume "afp://TS431(AFP)._afpovertcp._tcp.local/Photography" end try end tell
Now when it runs, it immediately creates a "documents" folder in /Volumes/
Then it asks my password and then connects the drives. However, because "Documents" is already there, it creates the 'real' drive on "Documents-1". When I then disconnect the drives and connect them again via the script, they create a "documents-1" and "documents-2". This changes the path of the drive which gives me problems with applications that do not know the updated path.
The weird thing is that when I do connect manually via finder this does not happen although it still asks for the password.
Any ideas how to solve that?
-
Re: macOS Sierra Automount on Startup
macdoc Nov 7, 2016 10:04 PM (in response to hwoltering)you can try to unmount the documents-volume, before you try to mount it again.
but there is an original-(apple-)"documents" folder in your User-Folder, so, it could be useful, to rename your network-folder to "mydocuments"....
-
-
Re: macOS Sierra Automount on Startup
hendryman Nov 15, 2016 1:44 AM (in response to Tweak)i tweaked my applescript to klick the dialog box button by spawning a second applescript via shell right before my first (main) script issues the mount command - like this:
do shell script "
osascript -e 'delay 2 -- initial wait period until the server login/password box appears
tell application \"NetAuthAgent\" to activate
tell application \"System Events\" to keystroke return
delay 1 -- secondary wait period until the volumee chooser box appears
tell application \"NetAuthAgent\" to activate
tell application \"System Events\" to keystroke return' > /dev/null 2>&1 &"
very important: the "> /dev/null 2>&1 &" allows the "main" applescript to continue before the shell applescript ends, thus allowing two scripts to run in parallel
-
Re: macOS Sierra Automount on Startup
vbelloli Dec 13, 2016 4:36 PM (in response to Tweak)Problem finally solved by Apple with OSX 10.12.2
-
Re: macOS Sierra Automount on Startup
R-M-B Dec 14, 2016 9:55 AM (in response to vbelloli)See also the following article to modify the authentication behavior;
-
Re: macOS Sierra Automount on Startup
tnaseem Jan 25, 2017 3:48 PM (in response to R-M-B)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.
-
Re: macOS Sierra Automount on Startup
r-11 Mar 4, 2017 5:21 AM (in response to R-M-B)It seems odd. Aren't firewalls and sharing rules supposed to help with this issue?
-
-
Re: macOS Sierra Automount on Startup
mareich49 Jan 23, 2017 2:12 PM (in response to vbelloli)How was it solved?
-
-
-
Re: macOS Sierra Automount on Startup
gniemetz Jan 28, 2017 4:56 AM (in response to Tweak)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
-
Re: macOS Sierra Automount on Startup
gmon750 Feb 21, 2017 3:33 PM (in response to Tweak)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.
-
Re: macOS Sierra Automount on Startup
john daniel Feb 21, 2017 4:02 PM (in response to gmon750)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.
-
-
Re: macOS Sierra Automount on Startup
themacmeister Mar 13, 2017 11:09 PM (in response to Tweak)I can confirm this is working with mount_smbfs as well... (except without -t)
-
Re: macOS Sierra Automount on Startup
jeanfrancoish Apr 20, 2017 3:11 PM (in response to Tweak)Hi,
I am trying this, that is very simple and seems workinghttp://blog.grapii.com/2015/06/keep-network-drives-mounted-on-mac-os-x-using-autofs/