On Wed, Apr 29, 2020 at 11:19 AM Raffaele BELARDI <[email protected]> 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.

