Gentoo Archives: gentoo-user

From: lukash <lukkash@×××××.cz>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Shutdown through systemctl as a normal user
Date: Tue, 19 Jan 2016 16:49:46
Message-Id: 1453222166.15208.34.camel@email.cz
In Reply to: Re: [gentoo-user] Shutdown through systemctl as a normal user by Willie Matthews
1 On Mon, 2016-01-18 at 14:56 -0800, Willie Matthews wrote:
2 > On Mon, 18 Jan 2016 23:31:39 +0100
3 > lukash <lukkash@×××××.cz> wrote:
4 >
5 > > On Mon, 2016-01-18 at 20:00 +0100, wabenbau@×××××.com wrote:
6 > > > lukash <lukkash@×××××.cz> wrote:
7 > > >   
8 > > > > Hi all,
9 > > > >
10 > > > > I'm reading on the internet that systemctl poweroff should work
11 > > > > for normal user if he is the only one logged in, he is logged
12 > > > > in
13 > > > > locally
14 > > > > and his session is active. I seem to be meeting these
15 > > > > conditions:
16 > > > >
17 > > > > # loginctl
18 > > > >    SESSION        UID USER             SEAT
19 > > > >          2       1000 lukash           seat0
20 > > > >
21 > > > > $ loginctl show-session 2
22 > > > > Id=2
23 > > > > User=1000
24 > > > > Name=lu
25 > > > > Timestamp=Sat 2016-01-16 17:27:30 CET
26 > > > > TimestampMonotonic=9614418
27 > > > > VTNr=7
28 > > > > Seat=seat0
29 > > > > Display=:0
30 > > > > Remote=no
31 > > > > Service=lightdm
32 > > > > Desktop=awesome
33 > > > > Scope=session-2.scope
34 > > > > Leader=529
35 > > > > Audit=2
36 > > > > Type=x11
37 > > > > Class=user
38 > > > > Active=yes
39 > > > > State=active
40 > > > > IdleHint=no
41 > > > > IdleSinceHint=0
42 > > > > IdleSinceHintMonotonic=0
43 > > > >
44 > > > > But invoking the command gives me:
45 > > > >
46 > > > > $ systemctl poweroff
47 > > > > Failed to set wall message, ignoring: Access denied
48 > > > > Failed to power off system via logind: Access denied
49 > > > > Failed to start poweroff.target: Access denied
50 > > > >
51 > > > > How is this supposed to work on Gentoo?
52 > > > >
53 > > > > Thanks in advance,
54 > > > > Lukas  
55 > > >
56 > > > IIRC "CONFIG_AUDIT" and "CONFIG_HAVE_ARCH_AUDITSYSCALL" must be
57 > > > set
58 > > > in the kernel configuration. But as I don't use this method I
59 > > > cannot
60 > > > say this for sure.  
61 > >
62 > > Thanks. But I've got those in my kernel already...
63 > >
64 > > > --
65 > > > Regards
66 > > > wabe
67 > > >   
68 > >
69 >
70 > Try this https://wiki.archlinux.org/index.php/allow_users_to_shutdown
71 > ,
72 > I think you might be happy with it. I don't have systemd personally
73 > so
74 > I don't have any experience with it. From what I read on the wiki,
75 > this will be an easy fix.
76 >
77 > Instead of using users in the "Users without sudo privileges"
78 > section, I
79 > think you can also use groups without the hostname. All you would
80 > have
81 > to do is make a group that you would like to be able to shutdown or
82 > whatever with the computer.
83 >
84
85 Thank you, but I wanted to make the systemd-logind path work instead of
86 the sudo magic which I find kinda hackish.
87
88 I think my system meets the requirements, although I am not so sure
89 when 'it should work' is mentioned in various places, whether it is
90 supposed there are (for example) some polkit rules present in the
91 system (of which I didn't find any on my gentoo box).
92
93 The wiki link you mentioned does lead to some more information about
94 the permission checking which I'll investigate when I have more time.
95 But otherwise, short of installing Arch somewhere and have a look if
96 there's anything present that could make this work I am clueless :(
97
98 Cheers,
99 Lukas