I have tried to make a script for our employees in case of broken VPNd, so they could restart the VPN daemon with a simple script.
This is what I have come up with:
tell application "Terminal"
activate
tell window 1
do script "ssh admin@myserver.com"
end tell
close window 2
tell window 1
do shell script "serveradmin stop vpn" user name "adminuser" password "adminpassword" with administrator privileges
do shell script "serveradmin start vpn" user name "adminuser" password "adminpassword" with administrator privileges
end tell
end tell
With this I get a error “Terminal got an error: A priviledge violation occured”. I have tried to run this as admin on the local machine with the same error.
Should it be run as root? if so how do I run it as root from client machines?