Sunday, January 11, 2009

sudo visudo no password

To allow a user or group to sudo some commands without authentication:

Edit the /etc/sudoers file:
sudo visudo


Add a line with the username (or %group):
username ALL=NOPASSWD: HALT, REBOOT, /usr/bin/apt-get, /usr/bin/aptitude


Note: HALT and REBOOT are aliases you can add in the sudoers file, like this:
# Cmnd alias specification
Cmnd_Alias REBOOT = /sbin/reboot
Cmnd_Alias HALT = /sbin/halt


Just do 'which halt' to find the path to the executable