How to disable shutdown/reboot from lightdm in 14.04?
In 12.04 it was possible to prevent system shutdown or reboot from the login screen by adding the following restrictions in /etc/polkit-1/localauthority/50-local.d
(adapted from here):
[Disable lightdm PowerMgmt]
Identity=unix-user:lightdm
Action=org.freedesktop.consolekit.system.restart;org.freedesktop.consolekit.system.stop
ResultAny=no
ResultInactive=no
ResultActive=no
With 14.04, this rule seems to have no effect anymore. Any advice how to implement the restriction?
I think I've found the cause: the action seems to have changed to "org.freedesktop.login1.reboot" (and the-like).
Adding the following lines as /etc/polkit-1/localauthority/50-local.d/restrict-login-powermgmt.pkla
works:
[Disable lightdm PowerMgmt]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=no
ResultInactive=no
ResultActive=no
You still see a confirmation dialog but there are not buttons to confirm. Looks ugly, but works ;)
Unfortunately this applies to all users, not only the lightdm session, so you have to add a second rule to white-list them if desired.
Note that this method block solely reboot/etc commands issued from GUI. To block reboot/etc commands from command line one may use molly-guard - as explained in Disabling shutdown command for all users, even root - consequences?