Grub 2 Password Protection in debian?











up vote
1
down vote

favorite












I do as the following




  1. run grub-mkpasswd-pbkdf2 to get a string

  2. nano /boot/grub/grub.cfg

  3. add two lines

  4. set superusers="putyourusernamehere"

  5. password putyourusernamehere grub.pbkdf2 (omitted)


When I reopen my computer,it can't work,how can I take grub 2 Password Protection in debian ?










share|improve this question















migrated from stackoverflow.com Oct 16 '12 at 4:41


This question came from our site for professional and enthusiast programmers.



















    up vote
    1
    down vote

    favorite












    I do as the following




    1. run grub-mkpasswd-pbkdf2 to get a string

    2. nano /boot/grub/grub.cfg

    3. add two lines

    4. set superusers="putyourusernamehere"

    5. password putyourusernamehere grub.pbkdf2 (omitted)


    When I reopen my computer,it can't work,how can I take grub 2 Password Protection in debian ?










    share|improve this question















    migrated from stackoverflow.com Oct 16 '12 at 4:41


    This question came from our site for professional and enthusiast programmers.

















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I do as the following




      1. run grub-mkpasswd-pbkdf2 to get a string

      2. nano /boot/grub/grub.cfg

      3. add two lines

      4. set superusers="putyourusernamehere"

      5. password putyourusernamehere grub.pbkdf2 (omitted)


      When I reopen my computer,it can't work,how can I take grub 2 Password Protection in debian ?










      share|improve this question















      I do as the following




      1. run grub-mkpasswd-pbkdf2 to get a string

      2. nano /boot/grub/grub.cfg

      3. add two lines

      4. set superusers="putyourusernamehere"

      5. password putyourusernamehere grub.pbkdf2 (omitted)


      When I reopen my computer,it can't work,how can I take grub 2 Password Protection in debian ?







      debian password-protection grub






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 5 '16 at 10:27









      Vagnerr

      2721411




      2721411










      asked Oct 1 '12 at 11:18







      Dada Lili











      migrated from stackoverflow.com Oct 16 '12 at 4:41


      This question came from our site for professional and enthusiast programmers.






      migrated from stackoverflow.com Oct 16 '12 at 4:41


      This question came from our site for professional and enthusiast programmers.
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          Debian 8 (jessie) stores Grub 2 password parameters within the directory /etc/grub.d/ . Inside this directory there are only scripts used to generate the configuration file.



          So you can create a new script (e.g. /etc/grub.d/01_users ) with the following content:



          #!/bin/bash

          cat <<EOF
          set superusers="putyourusernamehere"
          password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...
          EOF


          All the above lines are part of the file, because it is a script whose output will go in the final configuration file. Since it is a script, it will only be processed if it is executable (chmod a+x ...).



          As an alternative, you may put just the lines you need in one of the existing files that are tweaked to output their own contents. Here you can see how /etc/grub.d/40_custom substitutes the shell with a tail command returning script contents starting from the third line:



          #!/bin/sh
          exec tail -n +3 $0

          set superusers="putyourusernamehere"
          password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...


          In some Ubuntu derivatives (e.g. Mint 19) the format of the password changed as follows:



          #!/bin/sh
          exec tail -n +3 $0

          set superusers=putyourusernamehere
          password_pbkdf2 putyourusernamehere grub.pbkdf2.sha512.10000.3450C89...


          You may want to add "--unrestricted" to the menu entries you want to boot without a password. For example within the file 10_linux :



          10_linux:CLASS="--class gnu-linux --class gnu --class os --unrestricted"


          Finally launch update-grub2 to generate the final configuration file /boot/grub/grub.cfg .






          share|improve this answer























          • Do you mean cat << EOF?
            – G-Man
            Jun 14 '15 at 9:00










          • @G-Man indeed txs
            – Enos D'Andrea
            Jun 14 '15 at 18:38


















          up vote
          0
          down vote













          Read this. Official documentation from the debian-based OS: Ubuntu. Maybe it can help






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fsuperuser.com%2fquestions%2f488275%2fgrub-2-password-protection-in-debian%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown
























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            Debian 8 (jessie) stores Grub 2 password parameters within the directory /etc/grub.d/ . Inside this directory there are only scripts used to generate the configuration file.



            So you can create a new script (e.g. /etc/grub.d/01_users ) with the following content:



            #!/bin/bash

            cat <<EOF
            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...
            EOF


            All the above lines are part of the file, because it is a script whose output will go in the final configuration file. Since it is a script, it will only be processed if it is executable (chmod a+x ...).



            As an alternative, you may put just the lines you need in one of the existing files that are tweaked to output their own contents. Here you can see how /etc/grub.d/40_custom substitutes the shell with a tail command returning script contents starting from the third line:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...


            In some Ubuntu derivatives (e.g. Mint 19) the format of the password changed as follows:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers=putyourusernamehere
            password_pbkdf2 putyourusernamehere grub.pbkdf2.sha512.10000.3450C89...


            You may want to add "--unrestricted" to the menu entries you want to boot without a password. For example within the file 10_linux :



            10_linux:CLASS="--class gnu-linux --class gnu --class os --unrestricted"


            Finally launch update-grub2 to generate the final configuration file /boot/grub/grub.cfg .






            share|improve this answer























            • Do you mean cat << EOF?
              – G-Man
              Jun 14 '15 at 9:00










            • @G-Man indeed txs
              – Enos D'Andrea
              Jun 14 '15 at 18:38















            up vote
            2
            down vote













            Debian 8 (jessie) stores Grub 2 password parameters within the directory /etc/grub.d/ . Inside this directory there are only scripts used to generate the configuration file.



            So you can create a new script (e.g. /etc/grub.d/01_users ) with the following content:



            #!/bin/bash

            cat <<EOF
            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...
            EOF


            All the above lines are part of the file, because it is a script whose output will go in the final configuration file. Since it is a script, it will only be processed if it is executable (chmod a+x ...).



            As an alternative, you may put just the lines you need in one of the existing files that are tweaked to output their own contents. Here you can see how /etc/grub.d/40_custom substitutes the shell with a tail command returning script contents starting from the third line:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...


            In some Ubuntu derivatives (e.g. Mint 19) the format of the password changed as follows:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers=putyourusernamehere
            password_pbkdf2 putyourusernamehere grub.pbkdf2.sha512.10000.3450C89...


            You may want to add "--unrestricted" to the menu entries you want to boot without a password. For example within the file 10_linux :



            10_linux:CLASS="--class gnu-linux --class gnu --class os --unrestricted"


            Finally launch update-grub2 to generate the final configuration file /boot/grub/grub.cfg .






            share|improve this answer























            • Do you mean cat << EOF?
              – G-Man
              Jun 14 '15 at 9:00










            • @G-Man indeed txs
              – Enos D'Andrea
              Jun 14 '15 at 18:38













            up vote
            2
            down vote










            up vote
            2
            down vote









            Debian 8 (jessie) stores Grub 2 password parameters within the directory /etc/grub.d/ . Inside this directory there are only scripts used to generate the configuration file.



            So you can create a new script (e.g. /etc/grub.d/01_users ) with the following content:



            #!/bin/bash

            cat <<EOF
            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...
            EOF


            All the above lines are part of the file, because it is a script whose output will go in the final configuration file. Since it is a script, it will only be processed if it is executable (chmod a+x ...).



            As an alternative, you may put just the lines you need in one of the existing files that are tweaked to output their own contents. Here you can see how /etc/grub.d/40_custom substitutes the shell with a tail command returning script contents starting from the third line:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...


            In some Ubuntu derivatives (e.g. Mint 19) the format of the password changed as follows:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers=putyourusernamehere
            password_pbkdf2 putyourusernamehere grub.pbkdf2.sha512.10000.3450C89...


            You may want to add "--unrestricted" to the menu entries you want to boot without a password. For example within the file 10_linux :



            10_linux:CLASS="--class gnu-linux --class gnu --class os --unrestricted"


            Finally launch update-grub2 to generate the final configuration file /boot/grub/grub.cfg .






            share|improve this answer














            Debian 8 (jessie) stores Grub 2 password parameters within the directory /etc/grub.d/ . Inside this directory there are only scripts used to generate the configuration file.



            So you can create a new script (e.g. /etc/grub.d/01_users ) with the following content:



            #!/bin/bash

            cat <<EOF
            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...
            EOF


            All the above lines are part of the file, because it is a script whose output will go in the final configuration file. Since it is a script, it will only be processed if it is executable (chmod a+x ...).



            As an alternative, you may put just the lines you need in one of the existing files that are tweaked to output their own contents. Here you can see how /etc/grub.d/40_custom substitutes the shell with a tail command returning script contents starting from the third line:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers="putyourusernamehere"
            password putyourusernamehere grub.pbkdf2 grub.pbkdf2.sha512.10000.3450C89...


            In some Ubuntu derivatives (e.g. Mint 19) the format of the password changed as follows:



            #!/bin/sh
            exec tail -n +3 $0

            set superusers=putyourusernamehere
            password_pbkdf2 putyourusernamehere grub.pbkdf2.sha512.10000.3450C89...


            You may want to add "--unrestricted" to the menu entries you want to boot without a password. For example within the file 10_linux :



            10_linux:CLASS="--class gnu-linux --class gnu --class os --unrestricted"


            Finally launch update-grub2 to generate the final configuration file /boot/grub/grub.cfg .







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 1 at 3:21

























            answered Jun 14 '15 at 6:38









            Enos D'Andrea

            1279




            1279












            • Do you mean cat << EOF?
              – G-Man
              Jun 14 '15 at 9:00










            • @G-Man indeed txs
              – Enos D'Andrea
              Jun 14 '15 at 18:38


















            • Do you mean cat << EOF?
              – G-Man
              Jun 14 '15 at 9:00










            • @G-Man indeed txs
              – Enos D'Andrea
              Jun 14 '15 at 18:38
















            Do you mean cat << EOF?
            – G-Man
            Jun 14 '15 at 9:00




            Do you mean cat << EOF?
            – G-Man
            Jun 14 '15 at 9:00












            @G-Man indeed txs
            – Enos D'Andrea
            Jun 14 '15 at 18:38




            @G-Man indeed txs
            – Enos D'Andrea
            Jun 14 '15 at 18:38












            up vote
            0
            down vote













            Read this. Official documentation from the debian-based OS: Ubuntu. Maybe it can help






            share|improve this answer

























              up vote
              0
              down vote













              Read this. Official documentation from the debian-based OS: Ubuntu. Maybe it can help






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                Read this. Official documentation from the debian-based OS: Ubuntu. Maybe it can help






                share|improve this answer












                Read this. Official documentation from the debian-based OS: Ubuntu. Maybe it can help







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 31 '12 at 20:56









                Nehal J Wani

                408615




                408615






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f488275%2fgrub-2-password-protection-in-debian%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

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                     ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕