Fluxbox shutdown through sudoers



If you are using menu1 from the first post, you will already have the options for both restart and shutdown. Basically adding:

#[exec] (Reboot) {su-to-root -X -c /sbin/reboot}
#[exec] (Shutdown) {su-to-root -X -c /sbin/halt}

will allow you to restart and shutdown but will also ask for a password.
In order to get around that you will need to edit your /etc/sudoers file. You must be root in order to do this.
Currently your file probably shows this:

# /etc/sudoers
# This file MUST be edited with the 'visudo' command as root.
# See the man page for details on how to write a sudoers file.
Defaults env_reset
# Host alias specification
# User alias specification
sleek sid = NOPASSWD: /usr/sbin/xfsm-shutdown-helper
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL

The part to add in order to not use a password is this:

# Cmnd alias specification
Cmnd_Alias SHUTDOWN = /sbin/shutdown
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

Note: sleek is my user name, and will have to be changed. This addition works for me nicely. Make sure to backup before changing.
The entries to add to your ~/.fluxbox menu are:

[exec] (Reboot) {sudo /sbin/shutdown -r now}
[exec] (Shutdown) {sudo /sbin/shutdown -h now}

After these changes you should be able to restart and shutdown from the menu without a password.




Please comment if you are using this  ‘how -to’.  All suggestions and comments welcome.