Gentoo Archives: gentoo-user

From: Raffaele BELARDI <raffaele.belardi@××.com>
To: "gentoo-user@l.g.o" <gentoo-user@l.g.o>
Subject: [gentoo-user] prevent users from shutting down while other users logged in
Date: Wed, 29 Apr 2020 16:19:40
Message-Id: AM0PR10MB2436D1C147F9C380C626178DF7AD0@AM0PR10MB2436.EURPRD10.PROD.OUTLOOK.COM
1 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.
2
3 Basically I'd like that:
4 - 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
5 - from the ssh shell the command would be always available (root or normal user, I don't care)
6 - 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
7
8 Thanks,
9
10 raffaele
11
12 [1] https://www.freedesktop.org/software/systemd/man/systemd-inhibit.html

Replies

Subject Author
Re: [gentoo-user] prevent users from shutting down while other users logged in Michael Jones <gentoo@×××××××.com>
Re: [gentoo-user] prevent users from shutting down while other users logged in Neil Bothwick <neil@××××××××××.uk>