Having a problem with sudo. As the user
forge I want to be able to run
sudo service php5-fpm reload without having to type a password. I've tried all of the variants below.
forge ALL=NOPASSWD: /usr/bin/service php5-fpm reload forge ALL=NOPASSWD: /usr/bin/service forge ALL=(ALL:ALL) NOPASSWD: /usr/bin/service forge ALL=(ALL:ALL) NOPASSWD: /usr/bin/service php5-fpm reload
But it keeps prompting me for a password. Tried loggin in and out.
# tail /var/log/auth.log Sep 16 09:28:19 apps sudo: pam_unix(sudo:auth): conversation failed Sep 16 09:28:19 apps sudo: pam_unix(sudo:auth): auth could not identify password for [forge]
This is the whole file.
# # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig # User privilege specification root ALL=(ALL:ALL) ALL #forge ALL=NOPASSWD: /usr/bin/service # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d
Using Ubuntu 14.04.1 LTS
$ which service /usr/sbin/service
$ sudo service [sudo] password for forge:
This is what worked.
# Cmnd alias specification Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig/, /usr/bin/service, /usr/sbin/service
forge ALL = (ALL) NOPASSWD: SERVICES
Tried to move the content of the
forge file into
visudo, but that didn't work.