Why can I reboot without sudo?

I accidentally typed “reboot” on bash on my non-root account. It rebooted without hesitation.

(System: latest manjaro, kde, x86-64 system.)

I am not sure since when this started. To be fair, I’ve never even thought about trying this before. However, I think this is an issue; Why can anyone reboot without sudo?

So far, what I’ve found out is as follows:

  1. Most commands that require sudo wouldn’t run without sudo. It may be that reboot is the only command that behaves like this.
  2. Some suggested that the one of the groups may be giving the privilege, but I am not sure how to identify them. Following is the groups my account is in.
    $ groups
    sys network power lp wheel anaconda $USER(replaced to mask my account name)
  3. The reboot command traces back to /usr/bin/reboot, which itself is an link to systemctl.
    $ ls -al /usr/bin/reboot
    lrwxrwxrwx 1 root root 9 1월 10일 02:14 /usr/bin/reboot → systemctl
  4. privilege for systemctl doesn’t seem that problematic.
    $ ls -al /usr/bin/systemctl
    -rwxr-xr-x 1 root root 309816 1월 10일 02:14 /usr/bin/systemctl

So, is this behavior normal or is this something I messed up? How do I fix the reboot so that it wouldn’t run without root?

It appears that this is the intended behavior.

ArchWiki: If you are using [systemd and] polkit, users with non-remote session can issue power-related commands as long as the session is not broken.

https://wiki.archlinux.org/title/systemd#Power_management

https://wiki.archlinux.org/title/Power_management#Allow_users_to_shutdown

3 Likes

I feared it would just simply reboot, but according to the references you gave, it seems to be very much aware of who has logged in and if it is safe to reboot. Thank you.

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.