Creating SSH keys to login into remote machines as root user












0














I have followed the process of creating the public and private keys so that I can login in to remote system without a password.



But I would like to login into the remote system as root user without password using SSH keys.



For example, vm2$ssh vm1@10.0.0.1 would give me vm1$ prompt but I need ssh vm1@10.0.0.1 to give me vm1#.



Is this possible?










share|improve this question





























    0














    I have followed the process of creating the public and private keys so that I can login in to remote system without a password.



    But I would like to login into the remote system as root user without password using SSH keys.



    For example, vm2$ssh vm1@10.0.0.1 would give me vm1$ prompt but I need ssh vm1@10.0.0.1 to give me vm1#.



    Is this possible?










    share|improve this question



























      0












      0








      0







      I have followed the process of creating the public and private keys so that I can login in to remote system without a password.



      But I would like to login into the remote system as root user without password using SSH keys.



      For example, vm2$ssh vm1@10.0.0.1 would give me vm1$ prompt but I need ssh vm1@10.0.0.1 to give me vm1#.



      Is this possible?










      share|improve this question















      I have followed the process of creating the public and private keys so that I can login in to remote system without a password.



      But I would like to login into the remote system as root user without password using SSH keys.



      For example, vm2$ssh vm1@10.0.0.1 would give me vm1$ prompt but I need ssh vm1@10.0.0.1 to give me vm1#.



      Is this possible?







      linux ssh remote-desktop root






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 1 at 12:01









      iBug

      2,33941739




      2,33941739










      asked Dec 1 at 11:50









      karra

      1




      1






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Yes you can, though this is not a recommended setup.



          To login as root user, you need to specify that you want the root user. The command would be



          ssh root@10.0.0.1


          Of course, this only logs in, so in order to use your keys, you have to copy them:



          ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1


          You'll be prompted for password once. After that, you can SSH as the root user on 10.0.0.1 with the first command.






          share|improve this answer





















          • ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1 when I am giving this command and entering the password its showing Permission Denied, please try again
            – karra
            Dec 1 at 12:12












          • @karra You'll need to enter the root password, or try something else (I'll add it later).
            – iBug
            Dec 1 at 12:13










          • Sorry if its naive. The password for $sudo -s and the root password are same. right ?
            – karra
            Dec 1 at 12:15










          • @karra yeah it is, but you need the root password of the remote machine
            – iBug
            Dec 1 at 12:16










          • yes, I am entering the remote machine password. I have even checked on the remote machine
            – karra
            Dec 1 at 12:17











          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',
          autoActivateHeartbeat: false,
          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%2f1379949%2fcreating-ssh-keys-to-login-into-remote-machines-as-root-user%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









          0














          Yes you can, though this is not a recommended setup.



          To login as root user, you need to specify that you want the root user. The command would be



          ssh root@10.0.0.1


          Of course, this only logs in, so in order to use your keys, you have to copy them:



          ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1


          You'll be prompted for password once. After that, you can SSH as the root user on 10.0.0.1 with the first command.






          share|improve this answer





















          • ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1 when I am giving this command and entering the password its showing Permission Denied, please try again
            – karra
            Dec 1 at 12:12












          • @karra You'll need to enter the root password, or try something else (I'll add it later).
            – iBug
            Dec 1 at 12:13










          • Sorry if its naive. The password for $sudo -s and the root password are same. right ?
            – karra
            Dec 1 at 12:15










          • @karra yeah it is, but you need the root password of the remote machine
            – iBug
            Dec 1 at 12:16










          • yes, I am entering the remote machine password. I have even checked on the remote machine
            – karra
            Dec 1 at 12:17
















          0














          Yes you can, though this is not a recommended setup.



          To login as root user, you need to specify that you want the root user. The command would be



          ssh root@10.0.0.1


          Of course, this only logs in, so in order to use your keys, you have to copy them:



          ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1


          You'll be prompted for password once. After that, you can SSH as the root user on 10.0.0.1 with the first command.






          share|improve this answer





















          • ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1 when I am giving this command and entering the password its showing Permission Denied, please try again
            – karra
            Dec 1 at 12:12












          • @karra You'll need to enter the root password, or try something else (I'll add it later).
            – iBug
            Dec 1 at 12:13










          • Sorry if its naive. The password for $sudo -s and the root password are same. right ?
            – karra
            Dec 1 at 12:15










          • @karra yeah it is, but you need the root password of the remote machine
            – iBug
            Dec 1 at 12:16










          • yes, I am entering the remote machine password. I have even checked on the remote machine
            – karra
            Dec 1 at 12:17














          0












          0








          0






          Yes you can, though this is not a recommended setup.



          To login as root user, you need to specify that you want the root user. The command would be



          ssh root@10.0.0.1


          Of course, this only logs in, so in order to use your keys, you have to copy them:



          ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1


          You'll be prompted for password once. After that, you can SSH as the root user on 10.0.0.1 with the first command.






          share|improve this answer












          Yes you can, though this is not a recommended setup.



          To login as root user, you need to specify that you want the root user. The command would be



          ssh root@10.0.0.1


          Of course, this only logs in, so in order to use your keys, you have to copy them:



          ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1


          You'll be prompted for password once. After that, you can SSH as the root user on 10.0.0.1 with the first command.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 1 at 12:03









          iBug

          2,33941739




          2,33941739












          • ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1 when I am giving this command and entering the password its showing Permission Denied, please try again
            – karra
            Dec 1 at 12:12












          • @karra You'll need to enter the root password, or try something else (I'll add it later).
            – iBug
            Dec 1 at 12:13










          • Sorry if its naive. The password for $sudo -s and the root password are same. right ?
            – karra
            Dec 1 at 12:15










          • @karra yeah it is, but you need the root password of the remote machine
            – iBug
            Dec 1 at 12:16










          • yes, I am entering the remote machine password. I have even checked on the remote machine
            – karra
            Dec 1 at 12:17


















          • ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1 when I am giving this command and entering the password its showing Permission Denied, please try again
            – karra
            Dec 1 at 12:12












          • @karra You'll need to enter the root password, or try something else (I'll add it later).
            – iBug
            Dec 1 at 12:13










          • Sorry if its naive. The password for $sudo -s and the root password are same. right ?
            – karra
            Dec 1 at 12:15










          • @karra yeah it is, but you need the root password of the remote machine
            – iBug
            Dec 1 at 12:16










          • yes, I am entering the remote machine password. I have even checked on the remote machine
            – karra
            Dec 1 at 12:17
















          ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1 when I am giving this command and entering the password its showing Permission Denied, please try again
          – karra
          Dec 1 at 12:12






          ssh-copy-id -i ~/.ssh/id_rsa root@10.0.0.1 when I am giving this command and entering the password its showing Permission Denied, please try again
          – karra
          Dec 1 at 12:12














          @karra You'll need to enter the root password, or try something else (I'll add it later).
          – iBug
          Dec 1 at 12:13




          @karra You'll need to enter the root password, or try something else (I'll add it later).
          – iBug
          Dec 1 at 12:13












          Sorry if its naive. The password for $sudo -s and the root password are same. right ?
          – karra
          Dec 1 at 12:15




          Sorry if its naive. The password for $sudo -s and the root password are same. right ?
          – karra
          Dec 1 at 12:15












          @karra yeah it is, but you need the root password of the remote machine
          – iBug
          Dec 1 at 12:16




          @karra yeah it is, but you need the root password of the remote machine
          – iBug
          Dec 1 at 12:16












          yes, I am entering the remote machine password. I have even checked on the remote machine
          – karra
          Dec 1 at 12:17




          yes, I am entering the remote machine password. I have even checked on the remote machine
          – karra
          Dec 1 at 12:17


















          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%2f1379949%2fcreating-ssh-keys-to-login-into-remote-machines-as-root-user%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

          Terni

          A new problem with tex4ht and tikz

          Sun Ra