Using /etc/sudoers to allow shutdown/restart without password

Using the menu options to restart and shutdown your computer

This works on Debian systems.  I don’t know if others are the same or not.  Let me know!
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.



  1. Keep blogging, please! I am new to Linux and even newer to Fluxbox. Finding usable guides that don’t expect you to know everything in advance is often difficult. I did what you said here. It was easy and it worked. Thank you!

  2. I’m just echoing what Shawn said. There’s gold in these posts of yours. I’ve used a bunch of your tips, and it’s really helped a lot. There are niggling things I didn’t understand how to work around, and you’ve helped overcome them. Many Thanks!

  3. Your tips on Fluxbox were a really nice find! I am adding many of them to my list.
    I am also trying to set up nicely my Ubuntu/Debian + Fluxbox box, after a first quick try. Currently I am struggling to find all the software I need with the least possible dependencies from GTK/QT. Quite hard…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s