Can't do that Dave

21.07.2010 9:36

Recently Debian desktops (and probably other distributions) got smart and won't allow you, a regular user, to shutdown the system if they think other users are logged in. The warning says System policy prevents stopping the system when other users are logged in.

I'm sure this is a most welcome addition to those 0.1% of installations that are actually used by multiple (human) users and allow shutting down the whole system by non-administrators. For the rest of us, this is just an irritation that pops up whenever you want to turn off the laptop and there's a root console or a sandboxed application running somewhere in the background.

It turns out this can be fixed in a rather trivial way. This post on Arch Linux Forums showed the way.

Drop a file named multiple-users.pkla into /etc/polkit-1/localauthority/50-local.d (not under /var/lib as suggested in the forum, as that is under package manager's control) with the following content:

[shutdown privs]
Identity=unix-user:username
Action=org.freedesktop.consolekit.system.restart-multiple-users;org.freedesktop.consolekit.system.stop-multiple-users
ResultAny=no
ResultInactive=no
ResultActive=yes

Of course add your user name above.

What this does is grant the restart and shutdown privileges to processes running under your user name while you have an "active local session". Not sure how they define what a local session is. Maybe an utmp record for a local terminal. See man pklocalauthority(8).

Posted by Tomaž | Categories: Code

Add a new comment


(No HTML tags allowed. Separate paragraphs with a blank line.)