ssh-copy-id ask for password












1














I created user and generated key with this commands



root# mkdir /usr/share/foreman/.ssh
root# chmod 700 /usr/share/foreman/.ssh
root# chown user:user/usr/share/foreman/.ssh

root# su user -s /bin/bash
user$ ssh-keygen


And then tryed to copy key (on same server) between user and root



user$ ssh-copy-id root@hostname.com
user$ ssh root@hostname.com


But when tryint to ssh-copy-id root is asking for password. Don't know why.



Found on internet commenting UsePAM can fix the issue, but did not worked for me.



#UsePAM yes


I have also in my sshd_config this option allowed



PasswordAuthentication yes









share|improve this question





























    1














    I created user and generated key with this commands



    root# mkdir /usr/share/foreman/.ssh
    root# chmod 700 /usr/share/foreman/.ssh
    root# chown user:user/usr/share/foreman/.ssh

    root# su user -s /bin/bash
    user$ ssh-keygen


    And then tryed to copy key (on same server) between user and root



    user$ ssh-copy-id root@hostname.com
    user$ ssh root@hostname.com


    But when tryint to ssh-copy-id root is asking for password. Don't know why.



    Found on internet commenting UsePAM can fix the issue, but did not worked for me.



    #UsePAM yes


    I have also in my sshd_config this option allowed



    PasswordAuthentication yes









    share|improve this question



























      1












      1








      1







      I created user and generated key with this commands



      root# mkdir /usr/share/foreman/.ssh
      root# chmod 700 /usr/share/foreman/.ssh
      root# chown user:user/usr/share/foreman/.ssh

      root# su user -s /bin/bash
      user$ ssh-keygen


      And then tryed to copy key (on same server) between user and root



      user$ ssh-copy-id root@hostname.com
      user$ ssh root@hostname.com


      But when tryint to ssh-copy-id root is asking for password. Don't know why.



      Found on internet commenting UsePAM can fix the issue, but did not worked for me.



      #UsePAM yes


      I have also in my sshd_config this option allowed



      PasswordAuthentication yes









      share|improve this question















      I created user and generated key with this commands



      root# mkdir /usr/share/foreman/.ssh
      root# chmod 700 /usr/share/foreman/.ssh
      root# chown user:user/usr/share/foreman/.ssh

      root# su user -s /bin/bash
      user$ ssh-keygen


      And then tryed to copy key (on same server) between user and root



      user$ ssh-copy-id root@hostname.com
      user$ ssh root@hostname.com


      But when tryint to ssh-copy-id root is asking for password. Don't know why.



      Found on internet commenting UsePAM can fix the issue, but did not worked for me.



      #UsePAM yes


      I have also in my sshd_config this option allowed



      PasswordAuthentication yes






      ssh users






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      steeldriver

      34.6k35083




      34.6k35083










      asked yesterday









      Delirium

      7818




      7818






















          1 Answer
          1






          active

          oldest

          votes


















          3














          The command



          ssh-copy-id root@hostname.com


          works by SSHing into the server and copying your SSH public key(s) to ~/.ssh/authorized_keys. If you don't already have public-key authentication, you will be asked for a password when SSHing into the server during this.






          share|improve this answer








          New contributor




          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Problem is when I use password it wont accept it, even it's really proper one.
            – Delirium
            yesterday






          • 1




            You're trying to log into root with a password, by default this isn't allowed. On the server in /etc/ssh/sshd_config, what is PermitRootLogin set to?
            – steeling
            yesterday










          • there is commented #PermitRootLogin prohibit-password
            – Delirium
            yesterday






          • 1




            The default value is prohibit-password. This means that SSHing into a server as root is allowed, but password authentication is explicitly not allowed. Either you can change this to no (NOT recommended), or you can manually copy the public key part of your key (ending in .pub) into /root/.ssh/authorized_keys on the server.
            – steeling
            yesterday












          • Thank you for advice. Interesting is that, I tryed to login from differend machine and use ssh-copy-id and it worked. It's seems like not working only for that specific user.
            – Delirium
            yesterday











          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%2f492484%2fssh-copy-id-ask-for-password%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














          The command



          ssh-copy-id root@hostname.com


          works by SSHing into the server and copying your SSH public key(s) to ~/.ssh/authorized_keys. If you don't already have public-key authentication, you will be asked for a password when SSHing into the server during this.






          share|improve this answer








          New contributor




          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Problem is when I use password it wont accept it, even it's really proper one.
            – Delirium
            yesterday






          • 1




            You're trying to log into root with a password, by default this isn't allowed. On the server in /etc/ssh/sshd_config, what is PermitRootLogin set to?
            – steeling
            yesterday










          • there is commented #PermitRootLogin prohibit-password
            – Delirium
            yesterday






          • 1




            The default value is prohibit-password. This means that SSHing into a server as root is allowed, but password authentication is explicitly not allowed. Either you can change this to no (NOT recommended), or you can manually copy the public key part of your key (ending in .pub) into /root/.ssh/authorized_keys on the server.
            – steeling
            yesterday












          • Thank you for advice. Interesting is that, I tryed to login from differend machine and use ssh-copy-id and it worked. It's seems like not working only for that specific user.
            – Delirium
            yesterday
















          3














          The command



          ssh-copy-id root@hostname.com


          works by SSHing into the server and copying your SSH public key(s) to ~/.ssh/authorized_keys. If you don't already have public-key authentication, you will be asked for a password when SSHing into the server during this.






          share|improve this answer








          New contributor




          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Problem is when I use password it wont accept it, even it's really proper one.
            – Delirium
            yesterday






          • 1




            You're trying to log into root with a password, by default this isn't allowed. On the server in /etc/ssh/sshd_config, what is PermitRootLogin set to?
            – steeling
            yesterday










          • there is commented #PermitRootLogin prohibit-password
            – Delirium
            yesterday






          • 1




            The default value is prohibit-password. This means that SSHing into a server as root is allowed, but password authentication is explicitly not allowed. Either you can change this to no (NOT recommended), or you can manually copy the public key part of your key (ending in .pub) into /root/.ssh/authorized_keys on the server.
            – steeling
            yesterday












          • Thank you for advice. Interesting is that, I tryed to login from differend machine and use ssh-copy-id and it worked. It's seems like not working only for that specific user.
            – Delirium
            yesterday














          3












          3








          3






          The command



          ssh-copy-id root@hostname.com


          works by SSHing into the server and copying your SSH public key(s) to ~/.ssh/authorized_keys. If you don't already have public-key authentication, you will be asked for a password when SSHing into the server during this.






          share|improve this answer








          New contributor




          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          The command



          ssh-copy-id root@hostname.com


          works by SSHing into the server and copying your SSH public key(s) to ~/.ssh/authorized_keys. If you don't already have public-key authentication, you will be asked for a password when SSHing into the server during this.







          share|improve this answer








          New contributor




          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered yesterday









          steeling

          715




          715




          New contributor




          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          steeling is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.












          • Problem is when I use password it wont accept it, even it's really proper one.
            – Delirium
            yesterday






          • 1




            You're trying to log into root with a password, by default this isn't allowed. On the server in /etc/ssh/sshd_config, what is PermitRootLogin set to?
            – steeling
            yesterday










          • there is commented #PermitRootLogin prohibit-password
            – Delirium
            yesterday






          • 1




            The default value is prohibit-password. This means that SSHing into a server as root is allowed, but password authentication is explicitly not allowed. Either you can change this to no (NOT recommended), or you can manually copy the public key part of your key (ending in .pub) into /root/.ssh/authorized_keys on the server.
            – steeling
            yesterday












          • Thank you for advice. Interesting is that, I tryed to login from differend machine and use ssh-copy-id and it worked. It's seems like not working only for that specific user.
            – Delirium
            yesterday


















          • Problem is when I use password it wont accept it, even it's really proper one.
            – Delirium
            yesterday






          • 1




            You're trying to log into root with a password, by default this isn't allowed. On the server in /etc/ssh/sshd_config, what is PermitRootLogin set to?
            – steeling
            yesterday










          • there is commented #PermitRootLogin prohibit-password
            – Delirium
            yesterday






          • 1




            The default value is prohibit-password. This means that SSHing into a server as root is allowed, but password authentication is explicitly not allowed. Either you can change this to no (NOT recommended), or you can manually copy the public key part of your key (ending in .pub) into /root/.ssh/authorized_keys on the server.
            – steeling
            yesterday












          • Thank you for advice. Interesting is that, I tryed to login from differend machine and use ssh-copy-id and it worked. It's seems like not working only for that specific user.
            – Delirium
            yesterday
















          Problem is when I use password it wont accept it, even it's really proper one.
          – Delirium
          yesterday




          Problem is when I use password it wont accept it, even it's really proper one.
          – Delirium
          yesterday




          1




          1




          You're trying to log into root with a password, by default this isn't allowed. On the server in /etc/ssh/sshd_config, what is PermitRootLogin set to?
          – steeling
          yesterday




          You're trying to log into root with a password, by default this isn't allowed. On the server in /etc/ssh/sshd_config, what is PermitRootLogin set to?
          – steeling
          yesterday












          there is commented #PermitRootLogin prohibit-password
          – Delirium
          yesterday




          there is commented #PermitRootLogin prohibit-password
          – Delirium
          yesterday




          1




          1




          The default value is prohibit-password. This means that SSHing into a server as root is allowed, but password authentication is explicitly not allowed. Either you can change this to no (NOT recommended), or you can manually copy the public key part of your key (ending in .pub) into /root/.ssh/authorized_keys on the server.
          – steeling
          yesterday






          The default value is prohibit-password. This means that SSHing into a server as root is allowed, but password authentication is explicitly not allowed. Either you can change this to no (NOT recommended), or you can manually copy the public key part of your key (ending in .pub) into /root/.ssh/authorized_keys on the server.
          – steeling
          yesterday














          Thank you for advice. Interesting is that, I tryed to login from differend machine and use ssh-copy-id and it worked. It's seems like not working only for that specific user.
          – Delirium
          yesterday




          Thank you for advice. Interesting is that, I tryed to login from differend machine and use ssh-copy-id and it worked. It's seems like not working only for that specific user.
          – Delirium
          yesterday


















          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%2f492484%2fssh-copy-id-ask-for-password%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 reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

          is 'sed' thread safe

          How to make a Squid Proxy server?