You are not logged in.
I want users to freely logout (from X to console) or reboot, but never power down. I can't find polkit rules to produce the result. KDE's "Leave" menu always shows either (a) or (b) cases,
(a) logout
(b) logout, reboot, power off
whereas what I want is
(c) logout, reboot
The Arch wiki shows polkit rules to disable hibernate and suspend. That file works and is in use.
Can someone explain what more polkit rules I need?
Offline
Have you edited kdmrc?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Here are some polkit actions you might find interesting:
org.freedesktop.login1.hibernate
org.freedesktop.login1.hibernate-multiple-sessions
org.freedesktop.login1.power-off
org.freedesktop.login1.power-off-multiple-sessions
org.freedesktop.login1.reboot
org.freedesktop.login1.reboot-multiple-sessions
org.freedesktop.login1.suspend
org.freedesktop.login1.suspend-multiple-sessions
org.freedesktop.upower.hibernate
org.freedesktop.upower.suspend| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Have you edited kdmrc?
No, I'm using startx. The KDE Leave dialog is still changed by polkit rules like suspend and hibernate mentioned.
Here are some polkit actions you might find interesting
Of course. The issue is what exact rules in what order will do the job. I couldn't find any combination. What always happens to me is reboot+powerdown or nothing. I just can't get reboot by itself without the powerdown.
Thanks.
Offline
Of course. The issue is what exact rules in what order will do the job. I couldn't find any combination. What always happens to me is reboot+powerdown or nothing. I just can't get reboot by itself without the powerdown.
Thanks.
I guess this should work: It allows nothing but reboot unless you give the admin password. Even reboot is not allowed if second user is logged in. If you want to completely hide the actions, maybe replace REQUIRE_ADMIN with FORBID.
REQUIRE_ADMIN: org.freedesktop.login1.hibernate
REQUIRE_ADMIN: org.freedesktop.login1.hibernate-multiple-sessions
REQUIRE_ADMIN: org.freedesktop.login1.power-off
REQUIRE_ADMIN: org.freedesktop.login1.power-off-multiple-sessions
ALLOW: org.freedesktop.login1.reboot
REQUIRE_ADMIN: org.freedesktop.login1.reboot-multiple-sessions
REQUIRE_ADMIN: org.freedesktop.login1.suspend
REQUIRE_ADMIN: org.freedesktop.login1.suspend-multiple-sessions| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
I think I'm doing so, give or take. I don't want admin use, just OFF, period. The rules currently show only the logout in KDE Leave. Poweroff is correctly gone. Reboot is incorrectly gone. I hvae tried different orderings to no effect, but welcome any test reports.
/*
file (works): /etc/polkit-1/rules.d/10-disable-suspend.rules
Removes suspend/hibernate popups whenever poweroff is shown.
*/
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" ||
action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
action.id == "org.freedesktop.login1.hibernate" ||
action.id == "org.freedesktop.login1.hibernate-multiple-sessions") {
return polkit.Result.NO;
}
});/*
file (fails): /etc/polkit-1/rules.d/11-disable-poweroff.rules
Incorrectly removes both poweroff and reboot. Want reboot!
*/
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.power-off" ||
action.id == "org.freedesktop.login1.power-off-multiple-sessions") {
return polkit.Result.NO;
}
});
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.reboot" ||
action.id == "org.freedesktop.login1.reboot-multiple-sessions") {
return polkit.Result.YES;
}
});Offline