Re: Prevent shutdown in Gnome
On 2011-03-28, Klistvud <quotations@aliceadsl.fr> wrote:
> Dne, 28. 03. 2011 13:22:10 je Paul van der Vlis napisal(a):
>> Hello,
>>
>> I would like to remove the shutdown option in the Gnome menu, it's to
>> prevent shutdown by mistake. Is here somebody who knows how?
>
> /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy
>
> Back it up first, then change the "yes" to a "no" where appropriate.
> There are settings for the active user and for inactive users. There
> are also settings for rebooting the computer. It's all pretty well
> commented anyway.
While the solution given above will work, it is not ideal. The file
/usr/share/polkit-1/actions/org.freedesktop.consolekit.policy is not a
configuration file and will be overwritten without warning on upgrade of
the consolekit package.
I looked into this problem last month (following the release of squeeze)
and, after much head scratching and reading of the man page for
pklocalauthority (and then more head scratching), I arrived at the
following alternative solution.
Create a file in the directory /etc/polkit-1/localauthority/50-local.d/.
Ensure that the name of the file is unique and that it ends in .pkla. To
prevent shutdown and poweroff, and a stanza such as the following to the
file:
[consolekit]
Identity=unix-user:*
Action=org.freedesktop.consolekit.system.*
ResultAny=no
ResultInactive=no
ResultActive=no
To prevent suspend and hibernate, add this stanza:
[upower]
Identity=unix-user:*
Action=org.freedesktop.upower.*
ResultAny=no
ResultInactive=no
ResultActive=no
The result will be that the relevant options are removed from the System
menu in GNOME. They will still be present at the login screen, but will
be ignored. (The integration of GDM3 and consolekit is still clearly a
work in progress.)
It shouldn't be as difficult as indicated above, but that's the way it
is. Note that GDM2 is still available in squeeze, so the administrator
can revert to the old way of restricting user actions if desired.
--
Liam O'Toole
Cork, Ireland
Reply to: