You can also exclude the file in sudoers to allow running it without a password. I suggest rather than editing the sudoers file, create an override like so:
- Code: Select all
sudo visudo -f /etc/sudoers.d/myOverrides
A new file called 'myOverrides' will be created and open in visudo (like the vi editor, but performs checks to make sure you don't lock yourself out of sudo with a syntax error). To allow any user to run the application without a password enter the following in to the file:
- Code: Select all
ALL ALL=(ALL) NOPASSWD: /usr/sbin/systemsetup
Save the file and exit. Then if you run
- Code: Select all
sudo /usr/sbin/systemsetup
it won't ask for a password, but note that you still have to use the sudo command.
WARNING: This has obvious security concerns. You can minimize those somewhat making a copy of the systemsetup file somewhere else with an innocuous name:
- Code: Select all
sudo cp /usr/sbin/systemsetup /Users/indigo/birthdaylist
(assuming the username you run Indigo under is "indigo")
Then of course you'd change your myOverrides file to point to the copied version of the file. You can also restrict it to the username Indigo is running as:
- Code: Select all
indigo ALL=(ALL) NOPASSWD: /Users/indigo/birthdaylist
You can also specify arguments such as:
- Code: Select all
indigo ALL=(ALL) NOPASSWD: /Users/indigo/birthdaylist -setremotelogin on
indigo ALL=(ALL) NOPASSWD: /Users/indigo/birthdaylist -f -setremotelogin off
The above will allow that command with those arguments to run without a password for the user 'indigo', but other users/commands/arguments will require a password.
Terry