Desiable shutdown for users
Desiable shutdown for users
Hello! Halt on Linux is disabled for average user by default. It will try to request sudo/root password and if fails returns:
sasha@fedora:~$ systemctl halt
Call to Halt failed: Access denied
How can I make same behavior for poweroff action? I know it is possible somehow via PolicyKit rulle
You're viewing a single thread.
The relevant polkit policies should be defined here: https://github.com/systemd/systemd/blob/main/src/login/org.freedesktop.login1.policy
Disabling is done with some rules like this: https://bbs.archlinux.org/viewtopic.php?id=152565
polkit.addRule(function(action, subject) { if (action.id.indexOf("org.freedesktop.login1.power-off") == 0) { return polkit.Result.AUTH_ADMIN; } });
Some other examples: https://gist.github.com/grawity/3886114
8 0 ReplyThank you, it works! But I got weird behavior:
- User sddm also cannot execute poweroff (it is ok) but if I press shutdown button in sddm it will poweroff (not ok).
- If I press shut down in KDE Plasma I will get black screen and no sddm (I can restart it with
systemctl restart sddm
from tty and it will work again) How can I fix this bugs?
2 0 ReplySorry, I have no idea.
1 0 ReplySDDM main process is running as root and ignores all policies. So only way is modifying SDDM source code(
1 0 Reply