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.

Is it possible to grant a particular user sudo access for one particular command only?

Thanks

--

More info:

We farm out lengthy optimisation runs to each other's boxes over ssh. These runs take hours, sometimes days.

The shutdown command can only be run in sudo. Being conscious of my environmental footprint, I would like to give the initiator(s) of these runs sudo access to the shutdown command on my box, without sudo access for everything else - so that they may shutdown my machine when they no longer need it.

I am aware that I can schedule a shutdown before I leave my box, but I am looking for a better solution.

share|improve this question
    
Can we assume you haven't looked at the docs? –  Ignacio Vazquez-Abrams Dec 22 '10 at 5:41
    
@Ignacio Vazquez-Abrams : which docs are you referring to? –  bguiz Jan 4 '11 at 0:09
1  
The sudoers(5) man page. –  Ignacio Vazquez-Abrams Jan 4 '11 at 0:50
    
Consider accepting the (seemingly correct) answer, or comment on what doesn't work for you. –  Daniel Beck May 15 '11 at 14:57

1 Answer 1

use

visudo

as root, and add

%admin ALL = NOPASSWD: /sbin/shutdown

to the end of the file, then

  • add the user to admin group

and you can run "sudo shutdown -h now" from the user.

or rather, chmod 4755 the shutdown command.

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.