From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 664A5138CBE for ; Sat, 21 Mar 2015 19:59:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BC0DCE096D; Sat, 21 Mar 2015 19:59:07 +0000 (UTC) Received: from mail-ig0-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 90139E0941 for ; Sat, 21 Mar 2015 19:59:06 +0000 (UTC) Received: by igcau2 with SMTP id au2so13824803igc.0 for ; Sat, 21 Mar 2015 12:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=N9mTv8fqdeC8DH4QnO5L8nLlZr0KbqaGmRtnDnrr640=; b=uVqQ2qN90kHy1K1x0yybAQWg7nK4fCMfSvZppXVO5OjaQ9f6rcq8678pg4KObaay4V 4ONB8m/rxUE43vN/w6pd413qbaNO6hcOuKHMguKVJKC9OyfhGy+e2d7k4DBO0xFOG+Ja VgjrNzRq3TxHUg6yaePC/e04R3D1CrPWiL1D8iVpFKvrj9ViiH57xhKHXSXzwU1GMwHr jZvN0/XVw/pKLz6ZGyvArMy4fXECzhtCR6h+/71Ez9Fzf6AqUFDAHRe9V210/YxCaKI8 QPedWi2XnzgfmVn7Cr/QdUOMC1vB59QTdACsTePfoKZT9Dq3GKPIqF1cZRoyZB0lXLCE m3eg== X-Received: by 10.50.50.140 with SMTP id c12mr4826888igo.5.1426967945846; Sat, 21 Mar 2015 12:59:05 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.107.149.149 with HTTP; Sat, 21 Mar 2015 12:58:45 -0700 (PDT) In-Reply-To: References: <20150321152656.a82a84b3e8a32c8b68554548@gmail.com> <20150321153934.01966ae8bd27daf7bcc47000@gmail.com> From: =?UTF-8?B?Q2FuZWsgUGVsw6FleiBWYWxkw6lz?= Date: Sat, 21 Mar 2015 13:58:45 -0600 Message-ID: Subject: Re: [gentoo-user] How to poweroff the system from user? To: gentoo-user@lists.gentoo.org Content-Type: multipart/alternative; boundary=047d7bdc117e84a7900511d1dddb X-Archives-Salt: 7d24f51a-dee4-46f9-999c-56ec068d9d76 X-Archives-Hash: a780b6d7b5a6b86aa76d8872d841bf0f --047d7bdc117e84a7900511d1dddb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Mar 21, 2015 at 1:47 PM, Rich Freeman wrote: > > On Sat, Mar 21, 2015 at 3:39 PM, German wrote: > > > > No, I am trying to shutdown from a console > > Well, the old answer would be that you need to use sudo to run it, as > shutting down is a privileged operation. > > I suspect that the new answer is that with appropriate > policykit/consolekit/etc settings you can probably allow somebody > sitting at a physical console to shut down the system, or any > logged-in user if you prefer. However, I haven't actually set that up > myself. logind does that for you automagically=E2=84=A2. The first seat has the rig= hts to poweroff or reboot the machine, and it can differentiate between local and remote logins. You can check if your user session has the permissions to poweroff/reboot via dbus: $ gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanPowerOff ('yes',) $ gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanReboot ('yes',) But you need systemd to use logind1. There has been some attempts to reimplement logind outside systemd, but I'm not sure how advanced they are. This kind of problems were one of the reasons for creating logind. Regards. -- Canek Pel=C3=A1ez Vald=C3=A9s Profesor de asignatura, Facultad de Ciencias Universidad Nacional Aut=C3=B3noma de M=C3=A9xico --047d7bdc117e84a7900511d1dddb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Sat, Mar 21, 2015 at 1:47 PM, Rich Freeman <rich0@gentoo.org> wrote:
>
>= ; On Sat, Mar 21, 2015 at 3:39 PM, German <gentgerman@gmail.com> wrote:
> >
> > No= , I am trying to shutdown from a console
>
> Well, the old answ= er would be that you need to use sudo to run it, as
> shutting down i= s a privileged operation.
>
> I suspect that the new answer is = that with appropriate
> policykit/consolekit/etc settings you can pro= bably allow somebody
> sitting at a physical console to shut down the= system, or any
> logged-in user if you prefer.=C2=A0 However, I have= n't actually set that up
> myself.

logind does that for yo= u automagically=E2=84=A2. The first seat has the rights to poweroff or rebo= ot the machine, and it can differentiate between local and remote logins. Y= ou can check if your user session has the permissions to poweroff/reboot vi= a dbus:

$ gdbus call --system --dest org.freedeskto= p.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.log= in1.Manager.CanPowerOff=C2=A0
('yes',)

$ gdbus call --system --dest org.freedesktop.login1 --object-pa= th /org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanReboo= t =C2=A0
('yes',)

But you = need systemd to use logind1. There has been some attempts to reimplement lo= gind outside systemd, but I'm not sure how advanced they are.

This kind of problems were one of the reasons for creating = logind.

Regards.
--
Canek Pel=C3=A1ez= Vald=C3=A9s
Profesor de asignatura, Facultad de Ciencias
Universidad= Nacional Aut=C3=B3noma de M=C3=A9xico
--047d7bdc117e84a7900511d1dddb--