To run the command poweroff or reboot one needs to be super user. Is there anyway I can run this as a normal user? I just don't want to sudo and enter my password every time I reboot or power off.

  • 2
    The answer depends on which init system your distro uses... For example, with systemd and an active logind session you can reboot or poweroff without elevated privileges providing no other user is still logged in... – jasonwryan Aug 6 '13 at 8:29
  • @jasonwryan I am currently using Ubuntu which doesnot use systemd by default.So you mean other Distros such as Arch can reboot without elavated privileges? – Stormvirux Aug 6 '13 at 9:17
  • Yes: as per the conditions in my first comment. – jasonwryan Aug 6 '13 at 9:36

I changed /etc/sudoers so that every user that is in the admin group can execute the following commands without being ask for a password.

sudo halt
sudo reboot
sudo poweroff

You just need to add the following lines to /etc/sudoers

## Admin user group is allowed to execute halt and reboot 
%admin ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff

and add yourself to the admin group.

If you want only one user to be able to do this just remove the %admin and replace it with username like this

## user is allowed to execute halt and reboot 
stormvirux ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff

You can find out more about /etc/sudoers with man sudoers or the online manpage


You can also create a new file under /etc/sudoers.d name it as you wish(I named it 'shutdown'), and put the following lines inside:

# Allows me to shutdown the system without a password

yourUserName ALL = NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff

Just change "yourUserName" for YOUR User Name, and add or remove commands to use, personally I use it only for shutdown. One of the main difference of creating a particular file under sudoers.d is that this file will survive System Upgrades

  • 1
    If you choose this approach, ensure that /etc/sudoers has an appropriate #include directive to read files from /etc/sudoers.d/. – patricktokeeffe Sep 30 '19 at 23:13

You can also achieve this by trick with setuid. I don't know if it will work on all systems, because they sometimes ignore setuid/setgid bit.

You can specify a group of users who can perform change of system state in my case it was adm. Then add appropriate users to this group.

gpasswd -a $USER adm

Specify permissions:

chmod 4550 /usr/bin/reboot

ls -l outpus should look like this:

-r-sr-x--- 1 root adm 18928 Mar 13  2015 /usr/bin/reboot

Afterwards you can just type:


Simplest solution:

sudo echo $USER >> /etc/shutdown.allow

Then you're able to use one of this commands:

shutdown -ah now   // halt
shutdown -ar now   // reboot

According man shutdown there is -a option for non-root usage:

If shutdown is called with the -a argument (add this to the invocation of shutdown in /etc/inittab), it checks to see if the file /etc/shutdown.allow is present. It then compares the login names in that file with the list of people that are logged in on a virtual console ...

It works in Debian Linux. And there is limit for 32 user names in /etc/shutdown.allow.

  • 4
    No such option on Fedora, CentOS or RHEL. – fpmurphy Nov 1 '17 at 5:02
  • 1
    This is also not working for Ubuntu, at least that is what I get from the docs. It would be helpful to see if this is a Debian only feature. – Raphael Ahrens Nov 1 '17 at 7:28
  • Still not in Ubuntu (18.04) in 2020 =} – tink Jan 15 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.