Allow users to shutdown

From ArchWiki

Jump to: navigation, search
i18n
English
Italiano
Русский
Українська

If you want the user to have the ability to shutdown or reboot you have to change file permissions for the halt command. Reboot is a symlink to halt, so that doesn't need to be changed. Type as root:

chmod +s /sbin/halt

Topic: http://bbs.archlinux.org/viewtopic.php?t=2787


Another option is to do this using sudo. First install sudo:

# pacman -Sy sudo

Then, as root, add the following to the end of /etc/sudoers using the visudo command. Substitute user for your username and hostname for the machines hostname.

user hostname = NOPASSWD: /sbin/shutdown -h now
user hostname = NOPASSWD: /sbin/reboot

Now your user can shutdown with sudo shutdown -h now, and reboot with reboot.


A third option, under Gnome is to perform the following commands:

su
your password
chmod +s /sbin/halt
cd /var/run
mkdir console
cd console
touch username

This adds the "reboot" and "halt" options to Gnome's logout menu for the user defined.


A fourth option, under XFCE is to install sudo. Then add the following line to /etc/sudoers using the visudo -f command. For all users:

%users hostname=NOPASSWD:/usr/lib/xfce4/xfsm-shutdown-helper

Substitute hostname for the machine's hostname.

For single user:

user hostname=NOPASSWD:/usr/lib/xfce4/xfsm-shutdown-helper

Substitute user for your username and hostname for the machine's hostname.

This activates the "reboot" and "turn off" options to XFCE's session-manager logout dialog for the user defined.

Personal tools