I am running Yosemite 10.10.5 and I have a shell script which I want to use to toggle whether my wifi connections run through tor or not. This uses the networksetup
a couple of times and so asks for my password each time I run or cancel it.
Is there a way to make a shell script run without requiring my password each time?
Thanks!
Best Answer
You can add a rule to the
/etc/sudoers
file to give your user access rights tonetworksetup
without a password.whoami
in Terminal)VISUAL=nano sudo visudo
- opens the sudoers file in a kind of friendly editorAdd
followed by an empty line(!)
You should now be able to run
networksetup
as the user from step 1 without a password prompt by simply enteringsudo networksetup
.