Cannot enter sleep mode as non-root user (Operation not permitted)

Jason Hunt jhunt at lynden.on.ca
Sun Apr 17 01:23:38 UTC 2016


On Fri, Apr 15, 2016 at 12:06 PM, Polytropon <freebsd at edvax.de> wrote:

> > Being in wheel just means you can su root, and only root can suspend the
> > system .. unless you have a suspend button .. or know root's password :)
>
> That is the key information: The program must be run by root.
> Being in the operator or wheel group is not sufficient.
>
>
Thanks.  I thought that might be the case but couldn't find anything online
which specifically stated root is required.

This old post is what got me thinking wheel or operator should be able to
do it, but I guess there's some misunderstanding of how XFCE actually
performs suspend/shutdown/reboot:
https://marc.info/?l=freebsd-questions&m=139039546710646&w=2

In the past I've always used full-blown DE's like XFCE and had to set the
rights in PolicyKit, but now using cwm so I need to use commands for these
types of tasks, and just kind of assumed I should be able to do it without
root access.

>
>
> >  > Does anyone have suggestions for how to troubleshoot this?
> >
> > Revise expectations or hack acpiconf.c :)
>
> Or use a program like su, sudo, or super, for example like this:
>
>         % sudo acpiconf -s3
>
> which should work as expected. It's possible to assign this command
> to a shell alias or even to a key (or key combination).
>
>
>
I thought about poking through the acpi code but decided to leave it as a
future project :)

My solution for now is to install sudo, set the following in
/usr/local/etc/sudoers:

%operator ALL=(root) NOPASSWD: /usr/sbin/zzz

Then set the following in .cshrc:

alias zzz       /usr/local/bin/sudo /usr/sbin/zzz


More information about the freebsd-questions mailing list