Accidentally deleted tmp folder











up vote
14
down vote

favorite
4












i was trying to run



sudo rm -r ./tmp


but instead typed



sudo rm -r /tmp


Will it be fixed by running?



sudo mkdir /tmp


if i do what permissions should i give it?



ps: i didnt log out of my system yet










share|improve this question


























    up vote
    14
    down vote

    favorite
    4












    i was trying to run



    sudo rm -r ./tmp


    but instead typed



    sudo rm -r /tmp


    Will it be fixed by running?



    sudo mkdir /tmp


    if i do what permissions should i give it?



    ps: i didnt log out of my system yet










    share|improve this question
























      up vote
      14
      down vote

      favorite
      4









      up vote
      14
      down vote

      favorite
      4






      4





      i was trying to run



      sudo rm -r ./tmp


      but instead typed



      sudo rm -r /tmp


      Will it be fixed by running?



      sudo mkdir /tmp


      if i do what permissions should i give it?



      ps: i didnt log out of my system yet










      share|improve this question













      i was trying to run



      sudo rm -r ./tmp


      but instead typed



      sudo rm -r /tmp


      Will it be fixed by running?



      sudo mkdir /tmp


      if i do what permissions should i give it?



      ps: i didnt log out of my system yet







      tmp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 21 '12 at 22:09









      Adonis K. Kakoulidis

      86321027




      86321027






















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          24
          down vote



          accepted










          I can't think of a reason why this shouldn't work. On my system, the permissions are set by:



          sudo chmod 1777 /tmp


          (drwxrwxrwxt)






          share|improve this answer





















          • I rebooted my system after deleting the /tmp folder and now it is not getting past lightdm.
            – Juzer Ali
            Dec 5 '12 at 4:49


















          up vote
          8
          down vote













          You should run the following commands to restore the tmp folder.



          sudo -i
          # You now have a root prompt and do not need to continue typing sudo
          mkdir /tmp
          chmod 1777 /tmp
          exit


          Then you sould be all good






          share|improve this answer



















          • 1




            I think that exiting the root prompt after the steps would be worth mentioning.
            – zxcdw
            Aug 22 '12 at 0:34


















          up vote
          4
          down vote













          To add to Alex's answer, you can do both those commands at the same time using the -m or --mode option for mkdir(1), which specifies the mode for the created directory:



          -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask


          So the command would be:



          sudo mkdir -m 1777 /tmp





          share|improve this answer




























            up vote
            -1
            down vote













            A reboot of the system will fix it up automatically, in case if you have issues with rebooting the system use sudo mkdir -m 1777 /tmp should work fine as mentioned in other answers.






            share|improve this answer

















            • 1




              Duplicate of accepted answer.
              – Fabby
              Dec 4 at 7:23










            • Not really - this one uniquely suggests that rebooting will fix
              – Zanna
              Dec 4 at 10:54






            • 1




              And how will the user issue that command if they have trouble rebooting?
              – Elder Geek
              Dec 7 at 17:20











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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%2faskubuntu.com%2fquestions%2f178751%2faccidentally-deleted-tmp-folder%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            24
            down vote



            accepted










            I can't think of a reason why this shouldn't work. On my system, the permissions are set by:



            sudo chmod 1777 /tmp


            (drwxrwxrwxt)






            share|improve this answer





















            • I rebooted my system after deleting the /tmp folder and now it is not getting past lightdm.
              – Juzer Ali
              Dec 5 '12 at 4:49















            up vote
            24
            down vote



            accepted










            I can't think of a reason why this shouldn't work. On my system, the permissions are set by:



            sudo chmod 1777 /tmp


            (drwxrwxrwxt)






            share|improve this answer





















            • I rebooted my system after deleting the /tmp folder and now it is not getting past lightdm.
              – Juzer Ali
              Dec 5 '12 at 4:49













            up vote
            24
            down vote



            accepted







            up vote
            24
            down vote



            accepted






            I can't think of a reason why this shouldn't work. On my system, the permissions are set by:



            sudo chmod 1777 /tmp


            (drwxrwxrwxt)






            share|improve this answer












            I can't think of a reason why this shouldn't work. On my system, the permissions are set by:



            sudo chmod 1777 /tmp


            (drwxrwxrwxt)







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 21 '12 at 22:18









            StarNamer

            2,4361324




            2,4361324












            • I rebooted my system after deleting the /tmp folder and now it is not getting past lightdm.
              – Juzer Ali
              Dec 5 '12 at 4:49


















            • I rebooted my system after deleting the /tmp folder and now it is not getting past lightdm.
              – Juzer Ali
              Dec 5 '12 at 4:49
















            I rebooted my system after deleting the /tmp folder and now it is not getting past lightdm.
            – Juzer Ali
            Dec 5 '12 at 4:49




            I rebooted my system after deleting the /tmp folder and now it is not getting past lightdm.
            – Juzer Ali
            Dec 5 '12 at 4:49












            up vote
            8
            down vote













            You should run the following commands to restore the tmp folder.



            sudo -i
            # You now have a root prompt and do not need to continue typing sudo
            mkdir /tmp
            chmod 1777 /tmp
            exit


            Then you sould be all good






            share|improve this answer



















            • 1




              I think that exiting the root prompt after the steps would be worth mentioning.
              – zxcdw
              Aug 22 '12 at 0:34















            up vote
            8
            down vote













            You should run the following commands to restore the tmp folder.



            sudo -i
            # You now have a root prompt and do not need to continue typing sudo
            mkdir /tmp
            chmod 1777 /tmp
            exit


            Then you sould be all good






            share|improve this answer



















            • 1




              I think that exiting the root prompt after the steps would be worth mentioning.
              – zxcdw
              Aug 22 '12 at 0:34













            up vote
            8
            down vote










            up vote
            8
            down vote









            You should run the following commands to restore the tmp folder.



            sudo -i
            # You now have a root prompt and do not need to continue typing sudo
            mkdir /tmp
            chmod 1777 /tmp
            exit


            Then you sould be all good






            share|improve this answer














            You should run the following commands to restore the tmp folder.



            sudo -i
            # You now have a root prompt and do not need to continue typing sudo
            mkdir /tmp
            chmod 1777 /tmp
            exit


            Then you sould be all good







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 22 '12 at 0:46

























            answered Aug 21 '12 at 22:24









            Alex L.

            2,5801218




            2,5801218








            • 1




              I think that exiting the root prompt after the steps would be worth mentioning.
              – zxcdw
              Aug 22 '12 at 0:34














            • 1




              I think that exiting the root prompt after the steps would be worth mentioning.
              – zxcdw
              Aug 22 '12 at 0:34








            1




            1




            I think that exiting the root prompt after the steps would be worth mentioning.
            – zxcdw
            Aug 22 '12 at 0:34




            I think that exiting the root prompt after the steps would be worth mentioning.
            – zxcdw
            Aug 22 '12 at 0:34










            up vote
            4
            down vote













            To add to Alex's answer, you can do both those commands at the same time using the -m or --mode option for mkdir(1), which specifies the mode for the created directory:



            -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask


            So the command would be:



            sudo mkdir -m 1777 /tmp





            share|improve this answer

























              up vote
              4
              down vote













              To add to Alex's answer, you can do both those commands at the same time using the -m or --mode option for mkdir(1), which specifies the mode for the created directory:



              -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask


              So the command would be:



              sudo mkdir -m 1777 /tmp





              share|improve this answer























                up vote
                4
                down vote










                up vote
                4
                down vote









                To add to Alex's answer, you can do both those commands at the same time using the -m or --mode option for mkdir(1), which specifies the mode for the created directory:



                -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask


                So the command would be:



                sudo mkdir -m 1777 /tmp





                share|improve this answer












                To add to Alex's answer, you can do both those commands at the same time using the -m or --mode option for mkdir(1), which specifies the mode for the created directory:



                -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask


                So the command would be:



                sudo mkdir -m 1777 /tmp






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 11 at 17:55









                strupo

                413




                413






















                    up vote
                    -1
                    down vote













                    A reboot of the system will fix it up automatically, in case if you have issues with rebooting the system use sudo mkdir -m 1777 /tmp should work fine as mentioned in other answers.






                    share|improve this answer

















                    • 1




                      Duplicate of accepted answer.
                      – Fabby
                      Dec 4 at 7:23










                    • Not really - this one uniquely suggests that rebooting will fix
                      – Zanna
                      Dec 4 at 10:54






                    • 1




                      And how will the user issue that command if they have trouble rebooting?
                      – Elder Geek
                      Dec 7 at 17:20















                    up vote
                    -1
                    down vote













                    A reboot of the system will fix it up automatically, in case if you have issues with rebooting the system use sudo mkdir -m 1777 /tmp should work fine as mentioned in other answers.






                    share|improve this answer

















                    • 1




                      Duplicate of accepted answer.
                      – Fabby
                      Dec 4 at 7:23










                    • Not really - this one uniquely suggests that rebooting will fix
                      – Zanna
                      Dec 4 at 10:54






                    • 1




                      And how will the user issue that command if they have trouble rebooting?
                      – Elder Geek
                      Dec 7 at 17:20













                    up vote
                    -1
                    down vote










                    up vote
                    -1
                    down vote









                    A reboot of the system will fix it up automatically, in case if you have issues with rebooting the system use sudo mkdir -m 1777 /tmp should work fine as mentioned in other answers.






                    share|improve this answer












                    A reboot of the system will fix it up automatically, in case if you have issues with rebooting the system use sudo mkdir -m 1777 /tmp should work fine as mentioned in other answers.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 4 at 6:53









                    Prashant Shubham

                    1




                    1








                    • 1




                      Duplicate of accepted answer.
                      – Fabby
                      Dec 4 at 7:23










                    • Not really - this one uniquely suggests that rebooting will fix
                      – Zanna
                      Dec 4 at 10:54






                    • 1




                      And how will the user issue that command if they have trouble rebooting?
                      – Elder Geek
                      Dec 7 at 17:20














                    • 1




                      Duplicate of accepted answer.
                      – Fabby
                      Dec 4 at 7:23










                    • Not really - this one uniquely suggests that rebooting will fix
                      – Zanna
                      Dec 4 at 10:54






                    • 1




                      And how will the user issue that command if they have trouble rebooting?
                      – Elder Geek
                      Dec 7 at 17:20








                    1




                    1




                    Duplicate of accepted answer.
                    – Fabby
                    Dec 4 at 7:23




                    Duplicate of accepted answer.
                    – Fabby
                    Dec 4 at 7:23












                    Not really - this one uniquely suggests that rebooting will fix
                    – Zanna
                    Dec 4 at 10:54




                    Not really - this one uniquely suggests that rebooting will fix
                    – Zanna
                    Dec 4 at 10:54




                    1




                    1




                    And how will the user issue that command if they have trouble rebooting?
                    – Elder Geek
                    Dec 7 at 17:20




                    And how will the user issue that command if they have trouble rebooting?
                    – Elder Geek
                    Dec 7 at 17:20


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f178751%2faccidentally-deleted-tmp-folder%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á

                    Eduardo VII do Reino Unido