For several OS X versions I've used:
/usr/bin/osascript -e mount volume "smb://yourserver" as user name "yourusername" with password “yourpassword”
This has worked great, a nice and quiet mount of the network share, if it is available of course.
Now recently I installed macOS Sierra (10.12 public beta, build 16A238m), and the script still works, however it will now suddenly always show a login dialog, pre-populated with the "yourusername" and "yourpassword" values. The user will still have to click "Connect" to mount the share.
Does anyone know if this is a "bug" in the beta version (I did report this with Apple's Feedback app), or is this expected and/or what would be the "fix" for that?
See also: AppleScript Documentation "mount volume"
/Volumes
folder where the network share is mounted to root access only, requiring user authorization to create the mount point. Unfortunately I don't know of a work around at the moment, though I'm going to play with modifying sudoers on the computer. I have an Open Radar at openradar.appspot.com/radar?id=4948585099558912 wheren Apple have confirmed it's locked down. – mattdwen Aug 16 '16 at 22:43open
, and giving the user name and password in the URL. See "method 2" in my other answer here – mivk Oct 30 '20 at 18:33