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.

I made an alias to shut down my arch linux computer. It runs sudo shutdown -h -P now. I run it and am asked for my password and then it shuts down and powers off. Is there a way I can get this to run without it needing root privileges to run?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

You can use visudo to edit your /etc/sudoers file and create an entry that allows your username to run shutdown without a password.

username hostname = NOPASSWD: /path/to/shutdown

See man sudo and man sudoers for more information.

share|improve this answer
    
Could I use a similar method to allow a user to update, but not install packages? that is, allow nopassword for pacman -Syu but not for pacman in general? –  Seamus Aug 4 '10 at 17:07
    
@Seamus: Yes, from man sudoers: "If a Cmnd has associated command line arguments, then the arguments in the Cmnd must match exactly those given by the user on the command line (or match the wildcards if there are any)." –  Dennis Williamson Aug 4 '10 at 17:28
add comment

Why not add yourself to the power group?

sudo gpasswd -a your_username power

share|improve this answer
add comment

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.