Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I hope this is the best section of this forum for posting my question. I was wondering if there is a simple way to prevent accidental shutdown when the ...
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    2

    Prevent shutdown when several users are logged in

    Hi,
    I hope this is the best section of this forum for posting my question. I was wondering if there is a simple way to prevent accidental shutdown when the following situation occurs:
    Sometimes, I log in on my father's computer to run some administrations' tasks (updates...). For that, I use SSH since I'm frequently far from my parents and what I want is to prevent a shutdown run by my father. Of course, he should be able to turn off by himself if nobody else is connected.
    Molly-Guard allows to prevent distant shutdown, my request is a kind of complementary software.
    Does anyone know a project which could fit with this request? Do you have simple ideas to write a short code (I know bash, perl, python... I can do it by myself but tips are welcome)
    Cheers,
    Francois

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    Well, I don't have an exact solution for you, but maybe I can point you in the right direction. Or at least a direction, right or not.

    You should be able to prevent shutdown or restart while multiple sessions are active using consolekit/policykit rules. Unfortunately, I can't find too much documentation on the issue and there have been many rapid changes. I don't know where Debian is at with them all.

    For me on Arch for example, there is the file /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy with entries like so

    Code:
    <action id="org.freedesktop.consolekit.system.stop-multiple-users">
        <description>Stop the system when multiple users are logged in</description>
        <message>System policy prevents stopping the system when other users are logged in</message>
        <defaults>
          <allow_inactive>no</allow_inactive>
          <allow_active>auth_admin_keep</allow_active>
        </defaults>
      </action>
    In Ubuntu these days, it's the default that shutting down while multiple users are logged is requires admin privileges.

    PolicyKit - Debian Wiki

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    2
    Thank you for the clue. I'll look that deep inside.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •