Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .