1 |
On Sat, Mar 21, 2015 at 1:47 PM, Rich Freeman <rich0@g.o> wrote: |
2 |
> |
3 |
> On Sat, Mar 21, 2015 at 3:39 PM, German <gentgerman@×××××.com> wrote: |
4 |
> > |
5 |
> > No, I am trying to shutdown from a console |
6 |
> |
7 |
> Well, the old answer would be that you need to use sudo to run it, as |
8 |
> shutting down is a privileged operation. |
9 |
> |
10 |
> I suspect that the new answer is that with appropriate |
11 |
> policykit/consolekit/etc settings you can probably allow somebody |
12 |
> sitting at a physical console to shut down the system, or any |
13 |
> logged-in user if you prefer. However, I haven't actually set that up |
14 |
> myself. |
15 |
|
16 |
logind does that for you automagically™. The first seat has the rights to |
17 |
poweroff or reboot the machine, and it can differentiate between local and |
18 |
remote logins. You can check if your user session has the permissions to |
19 |
poweroff/reboot via dbus: |
20 |
|
21 |
$ gdbus call --system --dest org.freedesktop.login1 --object-path |
22 |
/org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanPowerOff |
23 |
('yes',) |
24 |
|
25 |
$ gdbus call --system --dest org.freedesktop.login1 --object-path |
26 |
/org/freedesktop/login1 --method org.freedesktop.login1.Manager.CanReboot |
27 |
('yes',) |
28 |
|
29 |
But you need systemd to use logind1. There has been some attempts to |
30 |
reimplement logind outside systemd, but I'm not sure how advanced they are. |
31 |
|
32 |
This kind of problems were one of the reasons for creating logind. |
33 |
|
34 |
Regards. |
35 |
-- |
36 |
Canek Peláez Valdés |
37 |
Profesor de asignatura, Facultad de Ciencias |
38 |
Universidad Nacional Autónoma de México |