Re: [gentoo-user] prevent users from shutting down while other users logged in

2020-04-30 Thread Neil Bothwick
On Thu, 30 Apr 2020 09:19:15 +, Raffaele BELARDI wrote:

> > Can you configure the shutdown/reboot command called by XFCE? If so,
> > you can set it to a script that checks whether anyone else is logged
> > in before either executing the shutdown or displaying a "Daddy's
> > using the computer" dialog.  
>  
> I was hoping for a 'system' level solution.

Of course, I was suggesting this as a Plan B option.


-- 
Neil Bothwick

The considered application of terror is also a form of communication.


pgpEtv2zKD7Ai.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] prevent users from shutting down while other users logged in

2020-04-30 Thread Michael
On Thursday, 30 April 2020 10:19:15 BST Raffaele BELARDI wrote:
> > > Basically I'd like that:
> > > - if there is more than one user logged in, either locally via lighdm
> > > or remotely via SSH, the shutdown XFCE button is grayed out. Once all
> > > users except one have logged out, the button is again available
> > 
> > Can you configure the shutdown/reboot command called by XFCE? If so, you
> > can set it to a script that checks whether anyone else is logged in before
> > either executing the shutdown or displaying a "Daddy's using the computer"
> > dialog.
> 
> I was hoping for a 'system' level solution. I think it was consolekit that,
> when a user tried to shutdown while another user was logged presented a
> window asking for root password to execute the command. (ESC would let it
> continue and do the shutdown anyway, so it was not really working). I'll go
> for the manual way.
> 
> Thanks,
> 
> Raffaele

Yes, I recall the same, in particular when logged in on a console, or remotely 
over SSH, but I don't think I have not observed it on KDE/Plasma desktops for 
a while now.  Mind you, I have moved to elogind, so this may manage seats and 
signals differently.

signature.asc
Description: This is a digitally signed message part.


RE: [gentoo-user] prevent users from shutting down while other users logged in

2020-04-30 Thread Raffaele BELARDI
> > Basically I'd like that:
> > - if there is more than one user logged in, either locally via lighdm
> > or remotely via SSH, the shutdown XFCE button is grayed out. Once all
> > users except one have logged out, the button is again available
> 
> Can you configure the shutdown/reboot command called by XFCE? If so, you
> can set it to a script that checks whether anyone else is logged in before
> either executing the shutdown or displaying a "Daddy's using the computer"
> dialog.
 
I was hoping for a 'system' level solution. I think it was consolekit that, 
when a user tried to shutdown while another user was logged presented a window 
asking for root password to execute the command. (ESC would let it continue and 
do the shutdown anyway, so it was not really working). I'll go for the manual 
way.

Thanks,

Raffaele



Re: [gentoo-user] prevent users from shutting down while other users logged in

2020-04-29 Thread Neil Bothwick
On Wed, 29 Apr 2020 16:19:29 +, Raffaele BELARDI wrote:

> I often have the kids working on my main ~amd64 PC (XFCE, OpenRC,
> -consolekit) while I ssh into it doing some maintenance from an old PC.
> Often they shut it down without telling me first, so I loose part of my
> stuff. Is there a way to tell XFCE/elogind/PAM/lightdm/whoever to not
> allow shutdown from a regular user while another user is logged in? I
> understand that logind/systemd provides the system-inhibit [1] user
> command just for that, but I don't find the analogous for
> OpenRC/elogind.
> 
> Basically I'd like that:
> - if there is more than one user logged in, either locally via lighdm
> or remotely via SSH, the shutdown XFCE button is grayed out. Once all
> users except one have logged out, the button is again available

Can you configure the shutdown/reboot command called by XFCE? If so, you
can set it to a script that checks whether anyone else is logged in
before either executing the shutdown or displaying a "Daddy's using the
computer" dialog.


-- 
Neil Bothwick

A seminar on time travel will be held 2 weeks ago.


pgpJu6bMYXGf7.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] prevent users from shutting down while other users logged in

2020-04-29 Thread Michael Jones
On Wed, Apr 29, 2020 at 11:19 AM Raffaele BELARDI 
wrote:

> I often have the kids working on my main ~amd64 PC (XFCE, OpenRC,
> -consolekit) while I ssh into it doing some maintenance from an old PC.
> Often they shut it down without telling me first, so I loose part of my
> stuff. Is there a way to tell XFCE/elogind/PAM/lightdm/whoever to not allow
> shutdown from a regular user while another user is logged in? I understand
> that logind/systemd provides the system-inhibit [1] user command just for
> that, but I don’t find the analogous for OpenRC/elogind.
>
>
>
> Basically I’d like that:
>
> - if there is more than one user logged in, either locally via lighdm or
> remotely via SSH, the shutdown XFCE button is grayed out. Once all users
> except one have logged out, the button is again available
>
> - from the ssh shell the command would be always available (root or normal
> user, I don’t care)
>
> - permanently disabling the shutdown for the kids is not optimal, they
> should be able to stop the machine if he/she is the only user
>
>
>
> Thanks,
>
>
>
> raffaele
>
>
>
> [1] https://www.freedesktop.org/software/systemd/man/systemd-inhibit.html
>
>
>

What's to stop them from shutdown via the physical power button? I know
that's almost always how I shut down a computer, and I tend not to even
think of using the menu.

As for how to inhibit, you'll probably need to combine something that reads
the currently active user sessions, with a patch to the XFCE menu to use
that information.