This question already has an answer here:

I'm experimenting around with Debian and I'm wondering about their permissions concerning systemd and reboot. I made the following obersvations (Debian Buster with lightdm and i3 WM):

  • The commands poweroff etc. map to /sbin/poweroff which is a link to /bin/systemctl
  • /bin/systemctl has permissions -r-s------ and is inaccessible to the user
  • As a result, systemctl poweroff etc. will not work, not even systemctl --user mycommand will not work (unlike e.g. on Arch Linux).

However when I install KDE, I can poweroff and reboot from the menu without entering a password! I didn't find any useful answers online and I don't understand how this is possible. How do they achieve that?

marked as duplicate by Fiximan, Jeff Schaller May 27 at 19:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    KDE uses polkit like other DEs, please check here. In short: the GUI user is explicitly given the permission to perform these tasks. – Fiximan May 27 at 12:27

There is a mechanism called "polkit" that is used to (among other things) allow the user logged into the machine locally to perform certain tasks that on a traditional unix system would require root, such as shutting the machine down, connecting to networks etc.

There is a more in-depth answer at How does gnome reboot without root privileges? , ignore the talk of gnome in the question, this mechanism is used across many different desktops.

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