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.