Re: [gentoo-user] Shutdown through systemctl as a normal user

2016-01-29 Thread lukash
On Fri, 2016-01-22 at 19:47 -0500, Mike Gilbert wrote:
> On Sat, Jan 16, 2016 at 1:34 PM, lukash  wrote:
> > Hi all,
> > 
> > I'm reading on the internet that systemctl poweroff should work for
> > normal user if he is the only one logged in, he is logged in
> > locally
> > and his session is active. I seem to be meeting these conditions:
> > 
> > # loginctl
> >    SESSIONUID USER SEAT
> >  2   1000 lukash   seat0
> > 
> > $ loginctl show-session 2
> > Id=2
> > User=1000
> > Name=lu
> > Timestamp=Sat 2016-01-16 17:27:30 CET
> > TimestampMonotonic=9614418
> > VTNr=7
> > Seat=seat0
> > Display=:0
> > Remote=no
> > Service=lightdm
> > Desktop=awesome
> > Scope=session-2.scope
> > Leader=529
> > Audit=2
> > Type=x11
> > Class=user
> > Active=yes
> > State=active
> > IdleHint=no
> > IdleSinceHint=0
> > IdleSinceHintMonotonic=0
> > 
> > But invoking the command gives me:
> > 
> > $ systemctl poweroff
> > Failed to set wall message, ignoring: Access denied
> > Failed to power off system via logind: Access denied
> > Failed to start poweroff.target: Access denied
> > 
> > How is this supposed to work on Gentoo?
> 
> Make sure you have USE=policykit set for sys-apps/systemd.

That did it! Thanks! I feel kind of stupid now...

Lukas



Re: [gentoo-user] Shutdown through systemctl as a normal user

2016-01-22 Thread Mike Gilbert
On Sat, Jan 16, 2016 at 1:34 PM, lukash  wrote:
> Hi all,
>
> I'm reading on the internet that systemctl poweroff should work for
> normal user if he is the only one logged in, he is logged in locally
> and his session is active. I seem to be meeting these conditions:
>
> # loginctl
>SESSIONUID USER SEAT
>  2   1000 lukash   seat0
>
> $ loginctl show-session 2
> Id=2
> User=1000
> Name=lu
> Timestamp=Sat 2016-01-16 17:27:30 CET
> TimestampMonotonic=9614418
> VTNr=7
> Seat=seat0
> Display=:0
> Remote=no
> Service=lightdm
> Desktop=awesome
> Scope=session-2.scope
> Leader=529
> Audit=2
> Type=x11
> Class=user
> Active=yes
> State=active
> IdleHint=no
> IdleSinceHint=0
> IdleSinceHintMonotonic=0
>
> But invoking the command gives me:
>
> $ systemctl poweroff
> Failed to set wall message, ignoring: Access denied
> Failed to power off system via logind: Access denied
> Failed to start poweroff.target: Access denied
>
> How is this supposed to work on Gentoo?

Make sure you have USE=policykit set for sys-apps/systemd.



Re: [gentoo-user] Shutdown through systemctl as a normal user

2016-01-19 Thread lukash
On Mon, 2016-01-18 at 14:56 -0800, Willie Matthews wrote:
> On Mon, 18 Jan 2016 23:31:39 +0100
> lukash  wrote:
> 
> > On Mon, 2016-01-18 at 20:00 +0100, waben...@gmail.com wrote:
> > > lukash  wrote:
> > >   
> > > > Hi all,
> > > > 
> > > > I'm reading on the internet that systemctl poweroff should work
> > > > for normal user if he is the only one logged in, he is logged
> > > > in
> > > > locally
> > > > and his session is active. I seem to be meeting these
> > > > conditions:
> > > > 
> > > > # loginctl
> > > >    SESSIONUID USER SEAT
> > > >  2   1000 lukash           seat0
> > > > 
> > > > $ loginctl show-session 2
> > > > Id=2
> > > > User=1000
> > > > Name=lu
> > > > Timestamp=Sat 2016-01-16 17:27:30 CET
> > > > TimestampMonotonic=9614418
> > > > VTNr=7
> > > > Seat=seat0
> > > > Display=:0
> > > > Remote=no
> > > > Service=lightdm
> > > > Desktop=awesome
> > > > Scope=session-2.scope
> > > > Leader=529
> > > > Audit=2
> > > > Type=x11
> > > > Class=user
> > > > Active=yes
> > > > State=active
> > > > IdleHint=no
> > > > IdleSinceHint=0
> > > > IdleSinceHintMonotonic=0
> > > > 
> > > > But invoking the command gives me:
> > > > 
> > > > $ systemctl poweroff
> > > > Failed to set wall message, ignoring: Access denied
> > > > Failed to power off system via logind: Access denied
> > > > Failed to start poweroff.target: Access denied
> > > > 
> > > > How is this supposed to work on Gentoo?
> > > > 
> > > > Thanks in advance,
> > > > Lukas  
> > > 
> > > IIRC "CONFIG_AUDIT" and "CONFIG_HAVE_ARCH_AUDITSYSCALL" must be
> > > set
> > > in the kernel configuration. But as I don't use this method I
> > > cannot
> > > say this for sure.  
> > 
> > Thanks. But I've got those in my kernel already...
> > 
> > > --
> > > Regards
> > > wabe
> > >   
> > 
> 
> Try this https://wiki.archlinux.org/index.php/allow_users_to_shutdown
> ,
> I think you might be happy with it. I don't have systemd personally
> so
> I don't have any experience with it. From what I read on the wiki,
> this will be an easy fix.
> 
> Instead of using users in the "Users without sudo privileges"
> section, I
> think you can also use groups without the hostname. All you would
> have
> to do is make a group that you would like to be able to shutdown or
> whatever with the computer.
> 

Thank you, but I wanted to make the systemd-logind path work instead of
the sudo magic which I find kinda hackish.

I think my system meets the requirements, although I am not so sure
when 'it should work' is mentioned in various places, whether it is
supposed there are (for example) some polkit rules present in the
system (of which I didn't find any on my gentoo box).

The wiki link you mentioned does lead to some more information about
the permission checking which I'll investigate when I have more time.
But otherwise, short of installing Arch somewhere and have a look if
there's anything present that could make this work I am clueless :(

Cheers,
Lukas



Re: [gentoo-user] Shutdown through systemctl as a normal user

2016-01-18 Thread wabenbau
lukash  wrote:

> Hi all,
> 
> I'm reading on the internet that systemctl poweroff should work for
> normal user if he is the only one logged in, he is logged in locally
> and his session is active. I seem to be meeting these conditions:
> 
> # loginctl
>    SESSIONUID USER SEAT
>  2   1000 lukash           seat0
> 
> $ loginctl show-session 2
> Id=2
> User=1000
> Name=lu
> Timestamp=Sat 2016-01-16 17:27:30 CET
> TimestampMonotonic=9614418
> VTNr=7
> Seat=seat0
> Display=:0
> Remote=no
> Service=lightdm
> Desktop=awesome
> Scope=session-2.scope
> Leader=529
> Audit=2
> Type=x11
> Class=user
> Active=yes
> State=active
> IdleHint=no
> IdleSinceHint=0
> IdleSinceHintMonotonic=0
> 
> But invoking the command gives me:
> 
> $ systemctl poweroff
> Failed to set wall message, ignoring: Access denied
> Failed to power off system via logind: Access denied
> Failed to start poweroff.target: Access denied
> 
> How is this supposed to work on Gentoo?
> 
> Thanks in advance,
> Lukas

IIRC "CONFIG_AUDIT" and "CONFIG_HAVE_ARCH_AUDITSYSCALL" must be set
in the kernel configuration. But as I don't use this method I cannot
say this for sure.

--
Regards
wabe



Re: [gentoo-user] Shutdown through systemctl as a normal user

2016-01-18 Thread Willie Matthews
On Mon, 18 Jan 2016 23:31:39 +0100
lukash  wrote:

> On Mon, 2016-01-18 at 20:00 +0100, waben...@gmail.com wrote:
> > lukash  wrote:
> >   
> > > Hi all,
> > > 
> > > I'm reading on the internet that systemctl poweroff should work
> > > for normal user if he is the only one logged in, he is logged in
> > > locally
> > > and his session is active. I seem to be meeting these conditions:
> > > 
> > > # loginctl
> > >    SESSIONUID USER SEAT
> > >  2   1000 lukash           seat0
> > > 
> > > $ loginctl show-session 2
> > > Id=2
> > > User=1000
> > > Name=lu
> > > Timestamp=Sat 2016-01-16 17:27:30 CET
> > > TimestampMonotonic=9614418
> > > VTNr=7
> > > Seat=seat0
> > > Display=:0
> > > Remote=no
> > > Service=lightdm
> > > Desktop=awesome
> > > Scope=session-2.scope
> > > Leader=529
> > > Audit=2
> > > Type=x11
> > > Class=user
> > > Active=yes
> > > State=active
> > > IdleHint=no
> > > IdleSinceHint=0
> > > IdleSinceHintMonotonic=0
> > > 
> > > But invoking the command gives me:
> > > 
> > > $ systemctl poweroff
> > > Failed to set wall message, ignoring: Access denied
> > > Failed to power off system via logind: Access denied
> > > Failed to start poweroff.target: Access denied
> > > 
> > > How is this supposed to work on Gentoo?
> > > 
> > > Thanks in advance,
> > > Lukas  
> > 
> > IIRC "CONFIG_AUDIT" and "CONFIG_HAVE_ARCH_AUDITSYSCALL" must be set
> > in the kernel configuration. But as I don't use this method I cannot
> > say this for sure.  
> 
> Thanks. But I've got those in my kernel already...
> 
> > --
> > Regards
> > wabe
> >   
> 

Try this https://wiki.archlinux.org/index.php/allow_users_to_shutdown ,
I think you might be happy with it. I don't have systemd personally so
I don't have any experience with it. From what I read on the wiki,
this will be an easy fix.

Instead of using users in the "Users without sudo privileges" section, I
think you can also use groups without the hostname. All you would have
to do is make a group that you would like to be able to shutdown or
whatever with the computer.

-- 

Willie Matthews
matthews.willi...@gmail.com
(702) 659-9966


pgpTqKuRmPajL.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] Shutdown through systemctl as a normal user

2016-01-18 Thread lukash
On Mon, 2016-01-18 at 20:00 +0100, waben...@gmail.com wrote:
> lukash  wrote:
> 
> > Hi all,
> > 
> > I'm reading on the internet that systemctl poweroff should work for
> > normal user if he is the only one logged in, he is logged in
> > locally
> > and his session is active. I seem to be meeting these conditions:
> > 
> > # loginctl
> >    SESSIONUID USER SEAT
> >  2   1000 lukash           seat0
> > 
> > $ loginctl show-session 2
> > Id=2
> > User=1000
> > Name=lu
> > Timestamp=Sat 2016-01-16 17:27:30 CET
> > TimestampMonotonic=9614418
> > VTNr=7
> > Seat=seat0
> > Display=:0
> > Remote=no
> > Service=lightdm
> > Desktop=awesome
> > Scope=session-2.scope
> > Leader=529
> > Audit=2
> > Type=x11
> > Class=user
> > Active=yes
> > State=active
> > IdleHint=no
> > IdleSinceHint=0
> > IdleSinceHintMonotonic=0
> > 
> > But invoking the command gives me:
> > 
> > $ systemctl poweroff
> > Failed to set wall message, ignoring: Access denied
> > Failed to power off system via logind: Access denied
> > Failed to start poweroff.target: Access denied
> > 
> > How is this supposed to work on Gentoo?
> > 
> > Thanks in advance,
> > Lukas
> 
> IIRC "CONFIG_AUDIT" and "CONFIG_HAVE_ARCH_AUDITSYSCALL" must be set
> in the kernel configuration. But as I don't use this method I cannot
> say this for sure.

Thanks. But I've got those in my kernel already...

> --
> Regards
> wabe
>