When I copy /etc/shadow to another system, is it possible to login with the according passwords?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am asking, because I generated a live CD using the hash from an existing /etc/shadow, assuming I will then be able to login with the corresponding password, but apparently login fails.







share|improve this question


























    up vote
    3
    down vote

    favorite












    I am asking, because I generated a live CD using the hash from an existing /etc/shadow, assuming I will then be able to login with the corresponding password, but apparently login fails.







    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I am asking, because I generated a live CD using the hash from an existing /etc/shadow, assuming I will then be able to login with the corresponding password, but apparently login fails.







      share|improve this question














      I am asking, because I generated a live CD using the hash from an existing /etc/shadow, assuming I will then be able to login with the corresponding password, but apparently login fails.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 30 '17 at 17:49









      G-Man

      11.6k82657




      11.6k82657










      asked Oct 30 '17 at 15:09









      user569825

      28229




      28229




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          It's possible if



          1. the target system uses shadow passwords, and


          2. /etc/shadow is not overridden by other mechanisms (via PAM, nss, etc.), and

          3. the target system doesn't hash /etc/shadow, and

          4. the target system has the same usernames as the source system, and

          5. the UIDs on the target system are the same as the UIDs on the source system, and

          6. the encryption methods used by the passwords need to be supported on the target system, and


          7. /etc/passwd on the target system must be in sync with the injected /etc/shadow.

          I hope I didn't forget anything. :)



          The easier (and safer) way to do it is to use vipw to save credentials for the relevant users on the source system, then copy them on the target system






          share|improve this answer






















          • Multiple encryption methods are available in glibc.
            – Christopher
            Oct 30 '17 at 15:50










          • Yes, the encryption methods used by the passwords need to be supported on the target system. That's unlikely to be a problem these days.
            – Satō Katsura
            Oct 30 '17 at 16:03










          • It’s implied by your #4 and #5, but it might be clearer if you explicitly said that the /etc/passwd  on the target system must be in sync with the injected /etc/shadow.
            – G-Man
            Oct 30 '17 at 17:47










          • @G-Man Edited. Now it's redundant, but oh well. :)
            – Satō Katsura
            Oct 30 '17 at 17:49










          • To move users and their passwords, I found it easiest to create them on the new system, and then grep their entries from shadow: egrep "^(jane|joe):" /etc/shadow. Then do a replace in shadow.
            – hschou
            Oct 31 '17 at 7:08











          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f401420%2fwhen-i-copy-etc-shadow-to-another-system-is-it-possible-to-login-with-the-acco%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote



          accepted










          It's possible if



          1. the target system uses shadow passwords, and


          2. /etc/shadow is not overridden by other mechanisms (via PAM, nss, etc.), and

          3. the target system doesn't hash /etc/shadow, and

          4. the target system has the same usernames as the source system, and

          5. the UIDs on the target system are the same as the UIDs on the source system, and

          6. the encryption methods used by the passwords need to be supported on the target system, and


          7. /etc/passwd on the target system must be in sync with the injected /etc/shadow.

          I hope I didn't forget anything. :)



          The easier (and safer) way to do it is to use vipw to save credentials for the relevant users on the source system, then copy them on the target system






          share|improve this answer






















          • Multiple encryption methods are available in glibc.
            – Christopher
            Oct 30 '17 at 15:50










          • Yes, the encryption methods used by the passwords need to be supported on the target system. That's unlikely to be a problem these days.
            – Satō Katsura
            Oct 30 '17 at 16:03










          • It’s implied by your #4 and #5, but it might be clearer if you explicitly said that the /etc/passwd  on the target system must be in sync with the injected /etc/shadow.
            – G-Man
            Oct 30 '17 at 17:47










          • @G-Man Edited. Now it's redundant, but oh well. :)
            – Satō Katsura
            Oct 30 '17 at 17:49










          • To move users and their passwords, I found it easiest to create them on the new system, and then grep their entries from shadow: egrep "^(jane|joe):" /etc/shadow. Then do a replace in shadow.
            – hschou
            Oct 31 '17 at 7:08















          up vote
          6
          down vote



          accepted










          It's possible if



          1. the target system uses shadow passwords, and


          2. /etc/shadow is not overridden by other mechanisms (via PAM, nss, etc.), and

          3. the target system doesn't hash /etc/shadow, and

          4. the target system has the same usernames as the source system, and

          5. the UIDs on the target system are the same as the UIDs on the source system, and

          6. the encryption methods used by the passwords need to be supported on the target system, and


          7. /etc/passwd on the target system must be in sync with the injected /etc/shadow.

          I hope I didn't forget anything. :)



          The easier (and safer) way to do it is to use vipw to save credentials for the relevant users on the source system, then copy them on the target system






          share|improve this answer






















          • Multiple encryption methods are available in glibc.
            – Christopher
            Oct 30 '17 at 15:50










          • Yes, the encryption methods used by the passwords need to be supported on the target system. That's unlikely to be a problem these days.
            – Satō Katsura
            Oct 30 '17 at 16:03










          • It’s implied by your #4 and #5, but it might be clearer if you explicitly said that the /etc/passwd  on the target system must be in sync with the injected /etc/shadow.
            – G-Man
            Oct 30 '17 at 17:47










          • @G-Man Edited. Now it's redundant, but oh well. :)
            – Satō Katsura
            Oct 30 '17 at 17:49










          • To move users and their passwords, I found it easiest to create them on the new system, and then grep their entries from shadow: egrep "^(jane|joe):" /etc/shadow. Then do a replace in shadow.
            – hschou
            Oct 31 '17 at 7:08













          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






          It's possible if



          1. the target system uses shadow passwords, and


          2. /etc/shadow is not overridden by other mechanisms (via PAM, nss, etc.), and

          3. the target system doesn't hash /etc/shadow, and

          4. the target system has the same usernames as the source system, and

          5. the UIDs on the target system are the same as the UIDs on the source system, and

          6. the encryption methods used by the passwords need to be supported on the target system, and


          7. /etc/passwd on the target system must be in sync with the injected /etc/shadow.

          I hope I didn't forget anything. :)



          The easier (and safer) way to do it is to use vipw to save credentials for the relevant users on the source system, then copy them on the target system






          share|improve this answer














          It's possible if



          1. the target system uses shadow passwords, and


          2. /etc/shadow is not overridden by other mechanisms (via PAM, nss, etc.), and

          3. the target system doesn't hash /etc/shadow, and

          4. the target system has the same usernames as the source system, and

          5. the UIDs on the target system are the same as the UIDs on the source system, and

          6. the encryption methods used by the passwords need to be supported on the target system, and


          7. /etc/passwd on the target system must be in sync with the injected /etc/shadow.

          I hope I didn't forget anything. :)



          The easier (and safer) way to do it is to use vipw to save credentials for the relevant users on the source system, then copy them on the target system







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 31 '17 at 6:12

























          answered Oct 30 '17 at 15:47









          Satō Katsura

          10.7k11533




          10.7k11533











          • Multiple encryption methods are available in glibc.
            – Christopher
            Oct 30 '17 at 15:50










          • Yes, the encryption methods used by the passwords need to be supported on the target system. That's unlikely to be a problem these days.
            – Satō Katsura
            Oct 30 '17 at 16:03










          • It’s implied by your #4 and #5, but it might be clearer if you explicitly said that the /etc/passwd  on the target system must be in sync with the injected /etc/shadow.
            – G-Man
            Oct 30 '17 at 17:47










          • @G-Man Edited. Now it's redundant, but oh well. :)
            – Satō Katsura
            Oct 30 '17 at 17:49










          • To move users and their passwords, I found it easiest to create them on the new system, and then grep their entries from shadow: egrep "^(jane|joe):" /etc/shadow. Then do a replace in shadow.
            – hschou
            Oct 31 '17 at 7:08

















          • Multiple encryption methods are available in glibc.
            – Christopher
            Oct 30 '17 at 15:50










          • Yes, the encryption methods used by the passwords need to be supported on the target system. That's unlikely to be a problem these days.
            – Satō Katsura
            Oct 30 '17 at 16:03










          • It’s implied by your #4 and #5, but it might be clearer if you explicitly said that the /etc/passwd  on the target system must be in sync with the injected /etc/shadow.
            – G-Man
            Oct 30 '17 at 17:47










          • @G-Man Edited. Now it's redundant, but oh well. :)
            – Satō Katsura
            Oct 30 '17 at 17:49










          • To move users and their passwords, I found it easiest to create them on the new system, and then grep their entries from shadow: egrep "^(jane|joe):" /etc/shadow. Then do a replace in shadow.
            – hschou
            Oct 31 '17 at 7:08
















          Multiple encryption methods are available in glibc.
          – Christopher
          Oct 30 '17 at 15:50




          Multiple encryption methods are available in glibc.
          – Christopher
          Oct 30 '17 at 15:50












          Yes, the encryption methods used by the passwords need to be supported on the target system. That's unlikely to be a problem these days.
          – Satō Katsura
          Oct 30 '17 at 16:03




          Yes, the encryption methods used by the passwords need to be supported on the target system. That's unlikely to be a problem these days.
          – Satō Katsura
          Oct 30 '17 at 16:03












          It’s implied by your #4 and #5, but it might be clearer if you explicitly said that the /etc/passwd  on the target system must be in sync with the injected /etc/shadow.
          – G-Man
          Oct 30 '17 at 17:47




          It’s implied by your #4 and #5, but it might be clearer if you explicitly said that the /etc/passwd  on the target system must be in sync with the injected /etc/shadow.
          – G-Man
          Oct 30 '17 at 17:47












          @G-Man Edited. Now it's redundant, but oh well. :)
          – Satō Katsura
          Oct 30 '17 at 17:49




          @G-Man Edited. Now it's redundant, but oh well. :)
          – Satō Katsura
          Oct 30 '17 at 17:49












          To move users and their passwords, I found it easiest to create them on the new system, and then grep their entries from shadow: egrep "^(jane|joe):" /etc/shadow. Then do a replace in shadow.
          – hschou
          Oct 31 '17 at 7:08





          To move users and their passwords, I found it easiest to create them on the new system, and then grep their entries from shadow: egrep "^(jane|joe):" /etc/shadow. Then do a replace in shadow.
          – hschou
          Oct 31 '17 at 7:08


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401420%2fwhen-i-copy-etc-shadow-to-another-system-is-it-possible-to-login-with-the-acco%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          The Forum (Inglewood, California)

          Palaiologos