#!/linuxSucks/Shutdown Void Linux without password

Dec 09, 2020

In Void Linux using just a window manager you don’t have the option to shutdown or reboot the computer without using a password to do it.

The simplest method to give any group of users the ability to shutdown/restart without entering a password and can be useful for simpler WMs, but instead allow users to customize menu actions, such as OpenBox, dmenu and shell scripts. This requires commands be pretended with sudo.

First add you user to the wheel group

sudo usermod -aG wheel user

Warning: NEVER edit /etc/sudoers directly! Always use the visudo command.

To allow members of the group “wheel” to shutdown without a password

sudo visudo

Find and comment this line (#)

#root ALL=(All:ALL) ALL

Find and uncomment this line

%wheel ALL=(ALL:ALL) ALL 

Save and close the file

Create a new file in sudoers.d

sudo visudo -f /et/sudoers.d/nopass

Add to the files, change user for the username

user ALL=(ALL:ALL) NOPASSWD: /usr/bin/halt, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/shutdown, /usr/bin/zzz, /usr/bin/ZZZ

Save the file and shutdown or reboot you computer. This will work out of the box.

Home  Linux  Notes  Blog Spot