In a bigger piece of AppleScript, I need to mount an SMB share. This works:

tell application "Finder" to mount volume "smb://server/share"

That is, it works without asking questions, from the Script Editor or from a shell running in Terminal (ie. osascript <my script>).

But when I try to run the same script while connected to the Mac through ssh from another computer, Finder (I suppose) first asks for confirmation with a dialog on the GUI:

You are attempting to connect to the server xxx. Click connect to contine.

How can I avoid this confirmation?


1 Answer 1


As mentioned by @klanomath, the confirmation can be disabled by following instructions on this page: https://support.apple.com/en-us/HT207112

That is, from a terminal:

sudo defaults write /Library/Preferences/com.apple.NetworkAuthorization AllowUnknownServers -bool YES

And then, to undo this change (for better security):

sudo defaults delete /Library/Preferences/com.apple.NetworkAuthorization AllowUnknownServers

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .