Using NOPASSWD for specific commands in sudoers file, PASSWD for all others

Posted by jberryman on Server Fault See other posts from Server Fault or by jberryman
Published on 2011-03-16T02:15:26Z Indexed on 2011/03/16 16:11 UTC
Read the original article Hit count: 328

Filed under:
|
|
|

I would like to configure sudo such that users can run some specific commands without entering a password (for convenience) and can run all other commands by entering a password.

This is what I have, but this does not work; a password is always required:

Defaults    env_reset Defaults    timestamp_timeout = 1 

root    ALL=(ALL:ALL) ALL 

# Allow members of group sudo to execute any command 
%sudo   ALL=(ALL:ALL) NOPASSWD: /usr/sbin/pm-suspend, /usr/bin/apt-get, PASSWD: ALL 

#includedir /etc/sudoers.d

Note that this is a debian system which uses this adding users to the "sudo" group method.

Thanks.

© Server Fault or respective owner

Related posts about linux

Related posts about debian