Disable OS X Server's shutdown prompt?
I've just installed OS X Server. Whenever I try to shut it down (as a local interactive user), I keep seeing a prompt that requires me to enter an admin's name and password before proceeding with the shutdown:
Shutting down may cause other users logged into this computer to lose unsaved changes.
I keep seeing this dialog even though there is nobody else connected to the machine.
Question is, how can I disable this dialog? I mean, let anybody who is logged in locally to shutdown the machine without entering an administrator password (or even without entering their own password?) I see this is not a security issue since with physical access, they can just press the power button.
My original intention is to use the living room's iMac as an Xcode build server, primarily to run unit tests. The machine starts and automatically logs in to a non-privileged account to make it convenient for people to use it to play videos and such. It would be nice to have this machine run unit tests as well, and it's really not critical if a build/run gets canceled mid-way because the machine is shutting down.
Server version: 4.1 (14S1092)
OS X: 10.10.3 (14D136)
One possible way could be by using a terminal command:
shutdown -h now
This immediately kills all processes and shuts your system down in a fairly nice manner.
As a normal user you could initiate this by
sudo shutdown -h now
But the problem with password prompt remains, this time in the terminal.
Having a closer look to the sudo configuration file /etc/sudoers
I found:
...
# User privilege specification
root ALL=(ALL) ALL
%admin ALL=(ALL) ALL
# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
...
Check whether your account is already in the wheel
or admin
group by issueing groups
in the terminal. If that is the case, just uncomment the line with %wheel
NOPASSWD or by adding NOPASSWD
at the proper position of the admin
line above (the wheel
line shows you how to do this). For instance:
tatooine-3:~ mallert$ groups
staff com.apple.sharepoint.group.2 everyone localaccounts _appserverusr
admin _appserveradm _lpadmin _appstore _lpoperator _developer
com.apple.access_screensharing com.apple.access_ssh com.apple.sharepoint.group.1
Here my user is already in the admin
group, therefore I would just add NOPASSWD
in the sudoers line like this:
%admin ALL=(ALL) NOPASSWD ALL
Now you should be able to fire up a
sudo shutdown -h now
without being asked for a password. To finalize my solution you could create an app with automator which executes this sudo shutdown -k now
command as a bash script.
If you want to reboot the server instead, use
sudo shutdown -r now