How to configure policykit to disable shutdown only if another user is logged in

Asked by Jeffrey Ratcliffe

I am trying to configure policykit to disable shutdown only if another user is logged in.

I have the file: /etc/polkit-1/localauthority/50-local.d/disable-shutdown.pkla with the following contents:

[Disable Shutdown, etc.]
Identity=unix-user:*
Action=org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=no
ResultInactive=no
ResultActive=no

Here, any user can log in, work, and shutdown. If the user simply logs out, and another logs in, then no user can shutdown (without invoking sudo).

If I change the above ResultActive to "yes", then any user can shutdown, even if another is logged in, i.e. the second user logs in via switch user.

How can I configure things so that any shutdown is only disabled if another user is logged in?

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.