How to disable poweroff/reboot to users?

William Oquendo woquendo at gmail.com
Sat Mar 18 10:51:06 CET 2017


Thanks a lot, it worked. I just adapted to include reboot and poweroff. Now
I know that in the future the key command is man polkit :)

On Fri, Mar 17, 2017 at 11:48 PM, Robby Workman <robby at rlworkman.net> wrote:

> On Fri, 17 Mar 2017 22:31:13 -0500
> William Oquendo <woquendo at gmail.com> wrote:
>
> > Hi all,
> > How can I disable shutdown and reboot from the menu to all present and
> > future users of a system running xfce?
> > This might be a question that appears frequently but after searching
> > and trying a lot of possibilities I cannot still make this happen. I
> > have tried changing the permissions for the halt, xfsm*,
> > xfce4-powermanager* commands (chmod o-x), creating a kioskrc file
> > (very old suggestion), but none of them worked. My sistem details are:
> > OS : Linux Slackware 14.2
> > xfce4 version 4.12
> > Thanks in advance
>
>
> Create a file, e.g. "disallow-power-options.rules" in
> /etc/polkit-1/rules.d/ with these contents:
>
> polkit.addRule(function(action, subject) {
>   if (action.id == "org.freedesktop.upower.suspend" &&
>       subject.isInGroup("wheel")) {
>     return polkit.Result.YES;
>     } else {
>       return polkit.Result.NO;
>   }
> });
>
> polkit.addRule(function(action, subject) {
>   if (action.id == "org.freedesktop.upower.hibernate" &&
>       subject.isInGroup("wheel")) {
>     return polkit.Result.YES;
>     } else {
>       return polkit.Result.NO;
>   }
> });
>
>
> polkit.addRule(function(action, subject) {
>   if (action.id.indexOf("org.freedesktop.consolekit.system.") == 0 &&
>       subject.isInGroup("wheel")) {
>       return polkit.Result.YES;
>     } else {
>       return polkit.Result.NO;
>   }
> });
>
> Note that these rules will also disallow sleep/suspend and hibernate,
> but they allow for all of these options if the logged in user happens
> to be a member of the "wheel" group. Adjust these as needed/desired.
>
> -RW
>



-- 

Best regards / Cordialmente,

William-Fernando Oquendo
--------------------------
Este correo puede carecer de tildes o eñes debido al teclado.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.xfce.org/pipermail/xfce/attachments/20170318/c2183cef/attachment.html>


More information about the Xfce mailing list