3

For one specific user I want to be able to restart Apache. This user does have sudo privileges and I could run sudo /etc/init.d/apache2 reload, but I want to include this restart script in a git post-receive hook. So this would prompt for the password and fail. So the question is: what is the proper way to allow this user to restart apache, without requiring sudo? I want to restrict option to only restarting Apache, and only this particular user.

1 Answer 1

7

You should consider using sudo with the NOPASSWD config.

See man 5 sudoers

Ex:

Host_Alias     LOCAL=192.168.0.1
user_foobar    LOCAL=NOPASSWD: /etc/init.d/apache2
2
  • 1
    You should consider NOPASSWD extremely carefully, though.
    – Shadur
    Mar 19, 2012 at 8:53
  • Sure, don't use that for all commands. Never something like LOCAL=NOPASSWD: /bin/bash Mar 19, 2012 at 13:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .