Thursday, 15 April 2010

Non sudo shutdown

Create a group of users called, `shutdown' who are able to do this:

$ groupadd shutdown

Add users to this new group, by editing /etc/group
Add the following:

shutdown:x:407:user1,user2,...

Specify the commands these users / this group can access without sudo:

$ visudo

and add the following lines.

%shutdown ALL=(root) NOPASSWD: /sbin/reboot
%shutdown ALL=(root) NOPASSWD: /sbin/halt
%shutdown ALL=(root) NOPASSWD: /sbin/shutdown

and now,

$ sudo shutdown -h now

should not require a password, if the correct user attempts it.

----------------------
Post modified from http://ubuntuforums.org/showthread.php?t=134968

No comments:

Post a Comment