How do I add the following to the sudoers file in RHEL5?
daemon ALL=(ALL) NOPASSWD: /usr/local/bin/php /var/www/batch.php
Thanks :)
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityHow do I add the following to the sudoers file in RHEL5?
daemon ALL=(ALL) NOPASSWD: /usr/local/bin/php /var/www/batch.php
Thanks :)
Use the visudo command for safe editing of the sudoers file, as root or with sudo:
visudo -f /etc/sudoers
If you don't know vi, you can use whatever editor you want by setting the EDITOR environment variable (assuming $VISUAL is not set), for example as root:
export EDITOR=/bin/nano
visudo -f /etc/sudoers
Although, if you don't know vi basics, maybe you shouldn't be editing your sudoers file :-)
Literally:
echo 'daemon ALL=(ALL) NOPASSWD: /usr/local/bin/php /var/www/batch.php' | sudo tee -a /etc/sudoers
Personally I'd recommend Kyle Brandt's solution.
[Edit] I've added sudo to the example as per Dennis Williamson's suggestion.