I'm trying to configure sudo to allow all users to restart apache without having to enter a password.
Security concerns aside, why isn't this working?
I added the line to /etc/sudoers: %admin ALL=NOPASSWD: /usr/sbin/apache2ctl
$sudo -l
User aidan may run the following commands on this host:
(root) NOPASSWD: /usr/sbin/apache2ctl
(ALL) ALL
$sudo /usr/sbin/apache2ctl
[sudo] password for aidan:
Thanks for any help.
That should work fine assuming you put the
%admin ALL=NOPASSWD: /usr/sbin/apache2ctl
after the ALL rule and your goal is to have users of the admin group require a password for sudo for everything but the apache2ctl command.What you probably want from what you said however is group of users that can start and stop apache, say apachestart. Then:
I think you might be able to make it truly everyone by replacing %apachestart with ALL, but I would recommend that even less.