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

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.
  • 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 – Nikita Petrenko Oct 30 '16 at 16:10
  • It disables reboot/shutdown/... etc while the user is logged in. However, I still have those options in my login window – Nikita Petrenko Oct 30 '16 at 16:11
  • Whoops... it is also restricted to the user group – Nikita Petrenko Oct 30 '16 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 – Nikita Petrenko Oct 30 '16 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 '16 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.