2

I do heavy computations. I have set up a remote access to my PC. The real problem is that my family members use this PC as well, and they tend to forget that they shouldn't shut it down. I've tried moving /sbin/shutdown, /sbin/reboot, adding policies to polkit, using systemd-inhibit - this doesn't seem to solve the problem.

Are there any dirty methods, like removing system files, which I can use to break the shutdown process? I could write a python script which removes those files and readds them when needed

OpenSuse, KDE

1

1 Answer 1

3

PolicyKit's local authority kit will allow you to control such actions. I believe you'd need to:

  • create a file in the correct polkit directory/file that specifies the restrictions you'd like to place on the service,
  • specify a group that these restrictions apply to,
  • create the group,
  • add users to the group.
  • test.
11
  • I've added a rule which is restricted to this action ids: org.freedesktop.consolekit.system.stop org.freedesktop.consolekit.system.restart org.freedesktop.login1.reboot org.freedesktop.login1.reboot-multiple-sessions org.freedesktop.login1.power-off org.freedesktop.login1.power-off-multiple-sessions Oct 30, 2016 at 16:10
  • It disables reboot/shutdown/... etc while the user is logged in. However, I still have those options in my login window Oct 30, 2016 at 16:11
  • Whoops... it is also restricted to the user group Oct 30, 2016 at 16:13
  • Nevermind. Now it does return polkit.Result.NO; for anything that matches those conditions, without any restrictions to groups. Still I can shutdown from login window Oct 30, 2016 at 16:16
  • In your file, you'd do something like this: Identity=unix-group:no_shutdown . Where no shutdown is the name of the group you'll create, and then add the restricted users to.
    – marshki
    Oct 30, 2016 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .