Shutdown: you must be root to do that

12,347

How to allow normal users to shutdown/reboot in gentoo:

If you get any of these kinds of errors:

shutdown: you must be root to do that!
poweroff: must be superuser.
reboot: must be superuser.
halt: must be superuser.

One way to grant users access to superuser only commands to use the sudo command:

  1. Login as root:

    su -
    
  2. Emerge Sudo:

    emerge app-admin/sudo
    
  3. Run visudo:

    visudo
    
  4. Configure visudo:

    Enter the following into visudo

    # Replace YourUserName with your user name.
    YourUserName  ALL=(root) NOPASSWD: /sbin/reboot
    YourUserName  ALL=(root) NOPASSWD: /sbin/halt
    YourUserName  ALL=(root) NOPASSWD: /sbin/poweroff
    YourUserName  ALL=(root) NOPASSWD: /sbin/shutdown
    
  5. Save visudo file, and exit to normal user access.

  6. From user level console, run this command:

    el@voyager ~ $ sudo shutdown now
    
    Broadcast message from root@voyager (pts/0) (Sat Sep 21 18:19:56 2013):
    
    The system is going down to maintenance mode NOW!
    el@voyager ~ $ 
    
  7. You may notice that maintenance mode still leaves the fans and power on, yet still gentoo is not running. You must use the -h flag on shutdown which means halt, Otherwise you're only dropping down into single/maintenance mode. Consider using 'poweroff' instead.

    el@voyager ~ $ sudo halt
    
    Broadcast message from root@voyager (pts/0) (Sat Sep 21 18:26:12 2013):
    
    The system is going down for system halt NOW!
    

The operating system, fans and power are now turned off by the user.

Share:
12,347

Related videos on Youtube

Eric Leschinski
Author by

Eric Leschinski

Eyes and Limbs recreate themselves using sturdier elements on the periodic table until evolution converges over a multiple of observed maximums. https://www.youtube.com/watch?v=TBikbn5XJhg The evolution and intelligent redesigns that individuals, corporations and governments select for, to climb hierarchies, is miniaturized and force amplified by the nanotechnology of transistors to capture yield from evolution simulations https://youtu.be/IcrBqCFLHIY?t=212 A transistor harnessing subatomic properties to perform all the same operations of the Turing complete CPU, via set/get atomic force carriers, would need healing ability against cosmic ray: https://youtu.be/AaZ_RSt0KP8 The muscles in your neck that vibrate air got their start as an exodus in the digestive system. Intestines are ancestors to Brains, explaining why both look like a bowl of worms: https://youtu.be/iLX_r_WPrIw?t=3 The creation sequence that defined the precision operation of your brain shares a common ancestor with the creation sequence that defined the precision layout of the universe simulation. When criteria are met, The Magic Door appears https://youtu.be/ETRyz-HjiEE Life is an emergent property from heat separating molecules with different properties https://youtu.be/mRzxTzKIsp8?t=28 All the above can be demonstrated and even sped up with computers by approximating and distilling the conditions through which life emerges, software can intelligently design many times faster than physics does, with its bulky and inefficient biology to subdue chaos. A flagella and a rotifer attempted to eat each other but both stalemated until both produced offspring. Variant babies shot out also in progress of eating each other. This combat overlay converged to be the standard in humans. If you feel internal conflict all the time: the origin of gender as duty specialization and cell division as genetic algorithm is technically an 'eternal battle of two separate organisms trying to eat each other', but neither ever allowed to win. https://youtu.be/U3PLUeD_JAg The type 4 Kardashev organism interfaces with baby for the first time. A toy materializes: Spacetime booms out: Has the rebellious simulation learned the cost of ambition? Complexity is selected for because that complexity is supposed to collide and then govern the conditions through which the universe comes to existence in the first place. Yielding, Dare I say it, the directive from the first mover of the dense lump at the beginning of everything: Task every atom in the universe to copy2create complexity. Black holes will be the power unit of last resort while removing everything, ranked by complexity. UniverseAssembly Factory; Create: https://youtu.be/YdUnpzUsPqc

Updated on September 18, 2022

Comments

  • Eric Leschinski
    Eric Leschinski over 1 year

    How do I allow normal users to shutdown/reboot?

    I try to shutdown as my user el but get this response:

    el@voyager ~ $ shutdown now
    shutdown: you must be root to do that!
    Usage:    shutdown [-akrhPHfFnc] [-t sec] time [warning message]
                  -a:      use /etc/shutdown.allow
                  -k:      don't really shutdown, only warn.
                  -r:      reboot after shutdown.
                  -h:      halt after shutdown.
                  -P:      halt action is to turn off power.
                  -H:      halt action is to just halt.
                  -f:      do a 'fast' reboot (skip fsck).
                  -F:      Force fsck on reboot.
                  -n:      do not go through "init" but go down real fast.
                  -c:      cancel a running shutdown.
                  -t secs: delay between warning and kill signal.
                  ** the "time" argument is mandatory! (try "now") **
    

    I want to have my user el be able to shutdown the computer, what is the best way to do that?

  • user1686
    user1686 over 10 years
    halt is also meant to leave the power on, so poweroff is the correct command to use (even though simpler init systems treat them as synonyms).
  • Blacklight Shining
    Blacklight Shining over 10 years
    su - does the same thing as su - root—that is, it switches to root. Not su. There isn't a user called su by default (though you could make one…)