From owner-freebsd-questions@freebsd.org Sun Apr 17 12:56:02 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4F0BB109D8 for ; Sun, 17 Apr 2016 12:56:02 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CB371E93 for ; Sun, 17 Apr 2016 12:56:01 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-71-243.dynamic.qsc.de [92.195.71.243]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 766043CD82; Sun, 17 Apr 2016 14:55:57 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id u3HCtusf002160; Sun, 17 Apr 2016 14:55:56 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sun, 17 Apr 2016 14:55:56 +0200 From: Polytropon To: Jason Hunt Cc: freebsd-questions@freebsd.org Subject: Re: Cannot enter sleep mode as non-root user (Operation not permitted) Message-Id: <20160417145556.08614f61.freebsd@edvax.de> In-Reply-To: References: <20160416000316.V1139@sola.nimnet.asn.au> <20160415180613.c066affb.freebsd@edvax.de> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Apr 2016 12:56:02 -0000 On Sat, 16 Apr 2016 21:23:37 -0400, Jason Hunt wrote: > On Fri, Apr 15, 2016 at 12:06 PM, Polytropon 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. The problem with those DEs is that it's hard to understand how things are done, and when they stop working, it's almost impossible to state _what_ went wrong. :-) > > > > 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 :) Probably not a good idea: The security barrier within the program is well intended and desired. > 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 That should work (if "zzz" should select -s 3 as intended). You could also assign that command to a key (or key combination) on your keyboard, so a simple keypress will send the system to sleep. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...