Let Regular Users Shutdown a Linux MachinePosted by: Andrew SmithPoster contact info: andrew-smith at mail ru Author: Spencer Stirling, Andrew Smith Originally published: http://www.ma.utexas.edu/users/stirling/computergeek/shutdown.html Software: Linux All Linux The universal way to enable regular users to shut down the machine is sudo. First create a group for people who are allowed to shutdown the machine and add your user to it. Add the following line to /etc/group. The GID (103 in this example) can be any that's not being used already, you'll probably want to change it. shutdown:x:103:andrew Replace andrew with your username. You can add multiple users to the group like this:shutdown:x:103:andrew,john,jane Edit the /etc/sudoers file and add the following:%shutdown ALL=(root) NOPASSWD: /sbin/reboot %shutdown ALL=(root) NOPASSWD: /sbin/halt %shutdown ALL=(root) NOPASSWD: /sbin/shutdown Now any user who's part of the shutdown group can do for example:sudo /sbin/reboot Without getting an Only root can do that error.XFCE 4.2 (or newer i guess). Set up sudo access to /usr/libexec/xfsm-shutdown-helper . Edit the /etc/sudoers file and add the following:%shutdown ALL=(root) NOPASSWD: /usr/libexec/xfsm-shutdown-helper shutdown is the group you created above, NOPASSWD means you don't need to type your password when issuing the command.Have fun. Shutdown for the really lazy...Posted by: Jim McCallPoster contact info: jim@jimmccall.com Author: same as 'Posted by' Software: Slackware I have a little thing I add to some of the Slackware servers I set up that would fit right here. Many times when I setup a server for a small business, the people want to shut it down on the weekends or at night, etc. and so rather then expecting these non-computer people to first login and then shutdown, instead of just turning off the power, I edit inittab to include this: # What to do at the "Three Finger Salute". ca::ctrlaltdel:/sbin/poweroff -h Now I just put a message on the keyboard & screen to "Press Ctrl Alt Delete to power down." My slack boxes power down gracefully and no one even has to login. Best of all it is quick and easy for the person who has a tendency to just turn stuff off. |