How to block shutdown or reboot in Debian when other users logged in












0














I want to prevent users to start shutdown or reboot when another user is logged in. Users can be a TTY user (Ctrl+Alt+F3) or a ssh user from a client host.



In OpenBSD, I use polkit org.xfce.session.policy with a rule file to prevent such actions.



I need to find how to do this in Debian Testing (aka Buster).

I found org.freedesktop.login1.policy with actions

- org.freedesktop.login1.power-off

- org.freedesktop.login1.power-off-multiple-sessions.



and made rule files for these actions but it does not block shutdown or restart.

It seems to me that polkit is not responsible alone for these actions.



I don't know where to look for this; perhaps systemd or PAM ?









share
























  • What kind of rule files are you using ? polkit uses js syntax as opposed to the older policykit ini-style...
    – don_crissti
    1 hour ago






  • 1




    I use js syntax pkexec version 0.105
    – ctac_
    50 mins ago










  • If you have the right rules there's nothing else. logind executes those actions as long as the polkit authorization allows it
    – don_crissti
    49 mins ago










  • @K7AAY - what is the point of linking to wikipedia articles ? Those projects have their own sites, you know...
    – don_crissti
    47 mins ago
















0














I want to prevent users to start shutdown or reboot when another user is logged in. Users can be a TTY user (Ctrl+Alt+F3) or a ssh user from a client host.



In OpenBSD, I use polkit org.xfce.session.policy with a rule file to prevent such actions.



I need to find how to do this in Debian Testing (aka Buster).

I found org.freedesktop.login1.policy with actions

- org.freedesktop.login1.power-off

- org.freedesktop.login1.power-off-multiple-sessions.



and made rule files for these actions but it does not block shutdown or restart.

It seems to me that polkit is not responsible alone for these actions.



I don't know where to look for this; perhaps systemd or PAM ?









share
























  • What kind of rule files are you using ? polkit uses js syntax as opposed to the older policykit ini-style...
    – don_crissti
    1 hour ago






  • 1




    I use js syntax pkexec version 0.105
    – ctac_
    50 mins ago










  • If you have the right rules there's nothing else. logind executes those actions as long as the polkit authorization allows it
    – don_crissti
    49 mins ago










  • @K7AAY - what is the point of linking to wikipedia articles ? Those projects have their own sites, you know...
    – don_crissti
    47 mins ago














0












0








0







I want to prevent users to start shutdown or reboot when another user is logged in. Users can be a TTY user (Ctrl+Alt+F3) or a ssh user from a client host.



In OpenBSD, I use polkit org.xfce.session.policy with a rule file to prevent such actions.



I need to find how to do this in Debian Testing (aka Buster).

I found org.freedesktop.login1.policy with actions

- org.freedesktop.login1.power-off

- org.freedesktop.login1.power-off-multiple-sessions.



and made rule files for these actions but it does not block shutdown or restart.

It seems to me that polkit is not responsible alone for these actions.



I don't know where to look for this; perhaps systemd or PAM ?









share















I want to prevent users to start shutdown or reboot when another user is logged in. Users can be a TTY user (Ctrl+Alt+F3) or a ssh user from a client host.



In OpenBSD, I use polkit org.xfce.session.policy with a rule file to prevent such actions.



I need to find how to do this in Debian Testing (aka Buster).

I found org.freedesktop.login1.policy with actions

- org.freedesktop.login1.power-off

- org.freedesktop.login1.power-off-multiple-sessions.



and made rule files for these actions but it does not block shutdown or restart.

It seems to me that polkit is not responsible alone for these actions.



I don't know where to look for this; perhaps systemd or PAM ?







linux systemd xfce pam polkit





share














share












share



share








edited 55 mins ago









K7AAY

364319




364319










asked 1 hour ago









ctac_

1,374128




1,374128












  • What kind of rule files are you using ? polkit uses js syntax as opposed to the older policykit ini-style...
    – don_crissti
    1 hour ago






  • 1




    I use js syntax pkexec version 0.105
    – ctac_
    50 mins ago










  • If you have the right rules there's nothing else. logind executes those actions as long as the polkit authorization allows it
    – don_crissti
    49 mins ago










  • @K7AAY - what is the point of linking to wikipedia articles ? Those projects have their own sites, you know...
    – don_crissti
    47 mins ago


















  • What kind of rule files are you using ? polkit uses js syntax as opposed to the older policykit ini-style...
    – don_crissti
    1 hour ago






  • 1




    I use js syntax pkexec version 0.105
    – ctac_
    50 mins ago










  • If you have the right rules there's nothing else. logind executes those actions as long as the polkit authorization allows it
    – don_crissti
    49 mins ago










  • @K7AAY - what is the point of linking to wikipedia articles ? Those projects have their own sites, you know...
    – don_crissti
    47 mins ago
















What kind of rule files are you using ? polkit uses js syntax as opposed to the older policykit ini-style...
– don_crissti
1 hour ago




What kind of rule files are you using ? polkit uses js syntax as opposed to the older policykit ini-style...
– don_crissti
1 hour ago




1




1




I use js syntax pkexec version 0.105
– ctac_
50 mins ago




I use js syntax pkexec version 0.105
– ctac_
50 mins ago












If you have the right rules there's nothing else. logind executes those actions as long as the polkit authorization allows it
– don_crissti
49 mins ago




If you have the right rules there's nothing else. logind executes those actions as long as the polkit authorization allows it
– don_crissti
49 mins ago












@K7AAY - what is the point of linking to wikipedia articles ? Those projects have their own sites, you know...
– don_crissti
47 mins ago




@K7AAY - what is the point of linking to wikipedia articles ? Those projects have their own sites, you know...
– don_crissti
47 mins ago















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491038%2fhow-to-block-shutdown-or-reboot-in-debian-when-other-users-logged-in%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491038%2fhow-to-block-shutdown-or-reboot-in-debian-when-other-users-logged-in%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

サソリ

広島県道265号伴広島線

Accessing regular linux commands in Huawei's Dopra Linux