Why does systemctl halt asks for password but systemctl reboot and systemctl poweroff not?












2















I am using Debian 9.5. From terminal whenever I type the command systemctl halt, it will say:



Authentication is required to start halt.target


and it will ask for password. But I can use commands systemctl reboot and systemctl poweroff and they will not ask for password and will execute successfully. I think if it asks for password for halt then it should also ask for poweroff.










share|improve this question




















  • 2





    I guess there are polkit actions/policies for the convenience of being able to reboot/poweroff as a normal user (without administrative privileges). halt was probably not considered a command that would be used by "normal" users, so there was no policy added.

    – danzel
    Aug 4 '18 at 12:26
















2















I am using Debian 9.5. From terminal whenever I type the command systemctl halt, it will say:



Authentication is required to start halt.target


and it will ask for password. But I can use commands systemctl reboot and systemctl poweroff and they will not ask for password and will execute successfully. I think if it asks for password for halt then it should also ask for poweroff.










share|improve this question




















  • 2





    I guess there are polkit actions/policies for the convenience of being able to reboot/poweroff as a normal user (without administrative privileges). halt was probably not considered a command that would be used by "normal" users, so there was no policy added.

    – danzel
    Aug 4 '18 at 12:26














2












2








2


0






I am using Debian 9.5. From terminal whenever I type the command systemctl halt, it will say:



Authentication is required to start halt.target


and it will ask for password. But I can use commands systemctl reboot and systemctl poweroff and they will not ask for password and will execute successfully. I think if it asks for password for halt then it should also ask for poweroff.










share|improve this question
















I am using Debian 9.5. From terminal whenever I type the command systemctl halt, it will say:



Authentication is required to start halt.target


and it will ask for password. But I can use commands systemctl reboot and systemctl poweroff and they will not ask for password and will execute successfully. I think if it asks for password for halt then it should also ask for poweroff.







shutdown systemctl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 26 at 7:52







PRY

















asked Aug 4 '18 at 8:53









PRYPRY

1,89431024




1,89431024








  • 2





    I guess there are polkit actions/policies for the convenience of being able to reboot/poweroff as a normal user (without administrative privileges). halt was probably not considered a command that would be used by "normal" users, so there was no policy added.

    – danzel
    Aug 4 '18 at 12:26














  • 2





    I guess there are polkit actions/policies for the convenience of being able to reboot/poweroff as a normal user (without administrative privileges). halt was probably not considered a command that would be used by "normal" users, so there was no policy added.

    – danzel
    Aug 4 '18 at 12:26








2




2





I guess there are polkit actions/policies for the convenience of being able to reboot/poweroff as a normal user (without administrative privileges). halt was probably not considered a command that would be used by "normal" users, so there was no policy added.

– danzel
Aug 4 '18 at 12:26





I guess there are polkit actions/policies for the convenience of being able to reboot/poweroff as a normal user (without administrative privileges). halt was probably not considered a command that would be used by "normal" users, so there was no policy added.

– danzel
Aug 4 '18 at 12:26










1 Answer
1






active

oldest

votes


















3














In a later version, systemd v235, halt could be allowed without a password. In order to make it allowed, you would have to edit some polkit configuration file.



The description on the commit which added this feature for halt, says "the whole concept of halting isn't really too useful".[1] I think this point of view explains the difference v.s. poweroff/reboot :-).



Another way to look at it, is that poweroff/reboot buttons are provided in common GUIs, and we expect them to work without needing a password. The systemd project is providing a way to implement this. But the user does not normally want a separate button to "halt".



I reviewed this commit and helped approve it. I felt it was generally safer for systemd not to change this behaviour, and there wasn't a clear reason for change.



The original behaviour might have been considered simpler... maintaining code and documentation for an API if we didn't actually expect it to be used can be positively undesirable. Or it might have been a way to block users from doing something they didn't actually want to do. I'm not sure. I very vaguely imagined one other concern. "halt" is defined to enter the ROM Monitor, if there is one. If there was some hypothetical ROM Monitor which required a password at boot time, I am not certain that it would prompt for the password again when the OS handed back control.





Adding polkit support in v235 was a side-benefit of making logind support halt. This was implemented to make systemctl behave consistently for halt, but the polkit support wasn't really the reason.



[1] PR #6944 - "systemctl reboot/suspend tweaks" - commit 36b69c313120 - "logind: add Halt() and CanHalt() APIs"



Link: https://github.com/systemd/systemd/pull/6944/commits/36b69c31312007f522a2a7ae5087ae90bd7867cc



polkit hints



You can see the polkit default settings in /usr/share/polkit-1/actions/org.freedesktop.login1.policy. You can search for similar entries for power-off and reboot, and look at their <defaults> element. And in v235 and above, there will be an entry for halt which you can compare.



You may notice some additional details. Like, if you have logged in over the network, the system will require an admin password to power off.



If you know the right incantation, you can create a file somewhere under /etc/polkit-1 which provides a different setting from the default. My guess is you have to define a "rule".






share|improve this answer

























    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%2f460481%2fwhy-does-systemctl-halt-asks-for-password-but-systemctl-reboot-and-systemctl-pow%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    In a later version, systemd v235, halt could be allowed without a password. In order to make it allowed, you would have to edit some polkit configuration file.



    The description on the commit which added this feature for halt, says "the whole concept of halting isn't really too useful".[1] I think this point of view explains the difference v.s. poweroff/reboot :-).



    Another way to look at it, is that poweroff/reboot buttons are provided in common GUIs, and we expect them to work without needing a password. The systemd project is providing a way to implement this. But the user does not normally want a separate button to "halt".



    I reviewed this commit and helped approve it. I felt it was generally safer for systemd not to change this behaviour, and there wasn't a clear reason for change.



    The original behaviour might have been considered simpler... maintaining code and documentation for an API if we didn't actually expect it to be used can be positively undesirable. Or it might have been a way to block users from doing something they didn't actually want to do. I'm not sure. I very vaguely imagined one other concern. "halt" is defined to enter the ROM Monitor, if there is one. If there was some hypothetical ROM Monitor which required a password at boot time, I am not certain that it would prompt for the password again when the OS handed back control.





    Adding polkit support in v235 was a side-benefit of making logind support halt. This was implemented to make systemctl behave consistently for halt, but the polkit support wasn't really the reason.



    [1] PR #6944 - "systemctl reboot/suspend tweaks" - commit 36b69c313120 - "logind: add Halt() and CanHalt() APIs"



    Link: https://github.com/systemd/systemd/pull/6944/commits/36b69c31312007f522a2a7ae5087ae90bd7867cc



    polkit hints



    You can see the polkit default settings in /usr/share/polkit-1/actions/org.freedesktop.login1.policy. You can search for similar entries for power-off and reboot, and look at their <defaults> element. And in v235 and above, there will be an entry for halt which you can compare.



    You may notice some additional details. Like, if you have logged in over the network, the system will require an admin password to power off.



    If you know the right incantation, you can create a file somewhere under /etc/polkit-1 which provides a different setting from the default. My guess is you have to define a "rule".






    share|improve this answer






























      3














      In a later version, systemd v235, halt could be allowed without a password. In order to make it allowed, you would have to edit some polkit configuration file.



      The description on the commit which added this feature for halt, says "the whole concept of halting isn't really too useful".[1] I think this point of view explains the difference v.s. poweroff/reboot :-).



      Another way to look at it, is that poweroff/reboot buttons are provided in common GUIs, and we expect them to work without needing a password. The systemd project is providing a way to implement this. But the user does not normally want a separate button to "halt".



      I reviewed this commit and helped approve it. I felt it was generally safer for systemd not to change this behaviour, and there wasn't a clear reason for change.



      The original behaviour might have been considered simpler... maintaining code and documentation for an API if we didn't actually expect it to be used can be positively undesirable. Or it might have been a way to block users from doing something they didn't actually want to do. I'm not sure. I very vaguely imagined one other concern. "halt" is defined to enter the ROM Monitor, if there is one. If there was some hypothetical ROM Monitor which required a password at boot time, I am not certain that it would prompt for the password again when the OS handed back control.





      Adding polkit support in v235 was a side-benefit of making logind support halt. This was implemented to make systemctl behave consistently for halt, but the polkit support wasn't really the reason.



      [1] PR #6944 - "systemctl reboot/suspend tweaks" - commit 36b69c313120 - "logind: add Halt() and CanHalt() APIs"



      Link: https://github.com/systemd/systemd/pull/6944/commits/36b69c31312007f522a2a7ae5087ae90bd7867cc



      polkit hints



      You can see the polkit default settings in /usr/share/polkit-1/actions/org.freedesktop.login1.policy. You can search for similar entries for power-off and reboot, and look at their <defaults> element. And in v235 and above, there will be an entry for halt which you can compare.



      You may notice some additional details. Like, if you have logged in over the network, the system will require an admin password to power off.



      If you know the right incantation, you can create a file somewhere under /etc/polkit-1 which provides a different setting from the default. My guess is you have to define a "rule".






      share|improve this answer




























        3












        3








        3







        In a later version, systemd v235, halt could be allowed without a password. In order to make it allowed, you would have to edit some polkit configuration file.



        The description on the commit which added this feature for halt, says "the whole concept of halting isn't really too useful".[1] I think this point of view explains the difference v.s. poweroff/reboot :-).



        Another way to look at it, is that poweroff/reboot buttons are provided in common GUIs, and we expect them to work without needing a password. The systemd project is providing a way to implement this. But the user does not normally want a separate button to "halt".



        I reviewed this commit and helped approve it. I felt it was generally safer for systemd not to change this behaviour, and there wasn't a clear reason for change.



        The original behaviour might have been considered simpler... maintaining code and documentation for an API if we didn't actually expect it to be used can be positively undesirable. Or it might have been a way to block users from doing something they didn't actually want to do. I'm not sure. I very vaguely imagined one other concern. "halt" is defined to enter the ROM Monitor, if there is one. If there was some hypothetical ROM Monitor which required a password at boot time, I am not certain that it would prompt for the password again when the OS handed back control.





        Adding polkit support in v235 was a side-benefit of making logind support halt. This was implemented to make systemctl behave consistently for halt, but the polkit support wasn't really the reason.



        [1] PR #6944 - "systemctl reboot/suspend tweaks" - commit 36b69c313120 - "logind: add Halt() and CanHalt() APIs"



        Link: https://github.com/systemd/systemd/pull/6944/commits/36b69c31312007f522a2a7ae5087ae90bd7867cc



        polkit hints



        You can see the polkit default settings in /usr/share/polkit-1/actions/org.freedesktop.login1.policy. You can search for similar entries for power-off and reboot, and look at their <defaults> element. And in v235 and above, there will be an entry for halt which you can compare.



        You may notice some additional details. Like, if you have logged in over the network, the system will require an admin password to power off.



        If you know the right incantation, you can create a file somewhere under /etc/polkit-1 which provides a different setting from the default. My guess is you have to define a "rule".






        share|improve this answer















        In a later version, systemd v235, halt could be allowed without a password. In order to make it allowed, you would have to edit some polkit configuration file.



        The description on the commit which added this feature for halt, says "the whole concept of halting isn't really too useful".[1] I think this point of view explains the difference v.s. poweroff/reboot :-).



        Another way to look at it, is that poweroff/reboot buttons are provided in common GUIs, and we expect them to work without needing a password. The systemd project is providing a way to implement this. But the user does not normally want a separate button to "halt".



        I reviewed this commit and helped approve it. I felt it was generally safer for systemd not to change this behaviour, and there wasn't a clear reason for change.



        The original behaviour might have been considered simpler... maintaining code and documentation for an API if we didn't actually expect it to be used can be positively undesirable. Or it might have been a way to block users from doing something they didn't actually want to do. I'm not sure. I very vaguely imagined one other concern. "halt" is defined to enter the ROM Monitor, if there is one. If there was some hypothetical ROM Monitor which required a password at boot time, I am not certain that it would prompt for the password again when the OS handed back control.





        Adding polkit support in v235 was a side-benefit of making logind support halt. This was implemented to make systemctl behave consistently for halt, but the polkit support wasn't really the reason.



        [1] PR #6944 - "systemctl reboot/suspend tweaks" - commit 36b69c313120 - "logind: add Halt() and CanHalt() APIs"



        Link: https://github.com/systemd/systemd/pull/6944/commits/36b69c31312007f522a2a7ae5087ae90bd7867cc



        polkit hints



        You can see the polkit default settings in /usr/share/polkit-1/actions/org.freedesktop.login1.policy. You can search for similar entries for power-off and reboot, and look at their <defaults> element. And in v235 and above, there will be an entry for halt which you can compare.



        You may notice some additional details. Like, if you have logged in over the network, the system will require an admin password to power off.



        If you know the right incantation, you can create a file somewhere under /etc/polkit-1 which provides a different setting from the default. My guess is you have to define a "rule".







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 4 '18 at 17:13

























        answered Aug 4 '18 at 16:28









        sourcejedisourcejedi

        24k439106




        24k439106






























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460481%2fwhy-does-systemctl-halt-asks-for-password-but-systemctl-reboot-and-systemctl-pow%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

            How to make a Squid Proxy server?

            第一次世界大戦

            Touch on Surface Book