How can I have Finder mount an SMB share from ssh without confirmation? 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 &lt;my script&gt;).

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?
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