Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example, I want to allow sudo shutdown -c to always be run without entering a password, but sudo shutdown without -c to always require a password (even if I've authenticated to sudo previously).

share|improve this question

1 Answer 1

To change your sudo configuration you need to edit you /etc/sudoers file by using visudo (Only use this because it has validation included. If you don't know how to use vi here are the quick basics you need to edit the file). To allow certain parameters there is an answer here. So you would basically add something like

user ALL=(root) NOPASSWD: /usr/bin/shutdown -c

to the file to allow all users to excecute shutdown -c without entering a password. To make sudo allways ask for a password you can set the timeout to 0 by adding

Defaults timestamp_timeout = 0

this is not command specific (sorry couldn't find anything better) but will ask for a password for all commands that need one to execute (ie there is no NOPASSWD option specified).

For more details on what you can do with your sudoers file see the official page.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.