Changing the order of private keys passed via ssh login

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











up vote
6
down vote

favorite












A server was set to accept three login attempts. The ssh system is checking three identity files before choosing the correct one.



The ssh command is as follows:



ssh -i ~/.ssh/username username@xx.xx.xx.xxx -v


The three identity files are as follows:



debug2: key: /path/to/.ssh/identity1 
debug2: key: /path/to/.ssh/identity2
debug2: key: /path/to/.ssh/identity3
debug2: key: /path/to/.ssh/username


How can I remove the three incorrect identity files? I have already tried deleting them from the directory, also I tried updating ~/.ssh/config as follows:



Host xx.xx.xx.xxx 
User username
IdentityFile ~/.ssh/username


How can I get have ssh to use the correct identity file?










share|improve this question



























    up vote
    6
    down vote

    favorite












    A server was set to accept three login attempts. The ssh system is checking three identity files before choosing the correct one.



    The ssh command is as follows:



    ssh -i ~/.ssh/username username@xx.xx.xx.xxx -v


    The three identity files are as follows:



    debug2: key: /path/to/.ssh/identity1 
    debug2: key: /path/to/.ssh/identity2
    debug2: key: /path/to/.ssh/identity3
    debug2: key: /path/to/.ssh/username


    How can I remove the three incorrect identity files? I have already tried deleting them from the directory, also I tried updating ~/.ssh/config as follows:



    Host xx.xx.xx.xxx 
    User username
    IdentityFile ~/.ssh/username


    How can I get have ssh to use the correct identity file?










    share|improve this question

























      up vote
      6
      down vote

      favorite









      up vote
      6
      down vote

      favorite











      A server was set to accept three login attempts. The ssh system is checking three identity files before choosing the correct one.



      The ssh command is as follows:



      ssh -i ~/.ssh/username username@xx.xx.xx.xxx -v


      The three identity files are as follows:



      debug2: key: /path/to/.ssh/identity1 
      debug2: key: /path/to/.ssh/identity2
      debug2: key: /path/to/.ssh/identity3
      debug2: key: /path/to/.ssh/username


      How can I remove the three incorrect identity files? I have already tried deleting them from the directory, also I tried updating ~/.ssh/config as follows:



      Host xx.xx.xx.xxx 
      User username
      IdentityFile ~/.ssh/username


      How can I get have ssh to use the correct identity file?










      share|improve this question















      A server was set to accept three login attempts. The ssh system is checking three identity files before choosing the correct one.



      The ssh command is as follows:



      ssh -i ~/.ssh/username username@xx.xx.xx.xxx -v


      The three identity files are as follows:



      debug2: key: /path/to/.ssh/identity1 
      debug2: key: /path/to/.ssh/identity2
      debug2: key: /path/to/.ssh/identity3
      debug2: key: /path/to/.ssh/username


      How can I remove the three incorrect identity files? I have already tried deleting them from the directory, also I tried updating ~/.ssh/config as follows:



      Host xx.xx.xx.xxx 
      User username
      IdentityFile ~/.ssh/username


      How can I get have ssh to use the correct identity file?







      linux ssh security






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 13 at 19:31









      Goro

      5,47052460




      5,47052460










      asked Feb 21 '13 at 2:16









      csi

      193210




      193210




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          See if the identity file is listed



          ssh-add -l


          If not, add it



          ssh-add ~/.ssh/username 


          Was then able to select the proper identity file






          share|improve this answer
















          • 1




            Was the reason for the problem that the other identities had been loaded by ssh-agent?
            – Hauke Laging
            Feb 21 '13 at 2:31










          • @HaukeLaging if so, this is a piece of information that should be included in the question; ie., that an agent is running...
            – jasonwryan
            Feb 21 '13 at 2:37










          • Yes, the other identities were previously loaded. @jasonwryan, would have included in the question had I known.
            – csi
            Feb 21 '13 at 15:00










          • @ChristopherIckes It is a wiki: you can edit your question and include other relevant information...
            – jasonwryan
            Feb 21 '13 at 17:24

















          up vote
          3
          down vote













          It looks like ssh is trying all the identities it knows about. If you want to only try the identity specified in the config file, add the line



          IdentitiesOnly = yes


          to that Host section of your .ssh/config file.



          Here's the relevant section of the ssh_config man page:




          IdentitiesOnly
          Specifies that ssh(1) should only use the authentication identity files configured in the ssh_config files, even if ssh-agent(1) offers more identities. The argument to this keyword must be ''yes'' or ''no''. This option is intended for situations where ssh-agent offers many different identities. The default is ''no''.







          share|improve this answer




















            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%2f65563%2fchanging-the-order-of-private-keys-passed-via-ssh-login%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            See if the identity file is listed



            ssh-add -l


            If not, add it



            ssh-add ~/.ssh/username 


            Was then able to select the proper identity file






            share|improve this answer
















            • 1




              Was the reason for the problem that the other identities had been loaded by ssh-agent?
              – Hauke Laging
              Feb 21 '13 at 2:31










            • @HaukeLaging if so, this is a piece of information that should be included in the question; ie., that an agent is running...
              – jasonwryan
              Feb 21 '13 at 2:37










            • Yes, the other identities were previously loaded. @jasonwryan, would have included in the question had I known.
              – csi
              Feb 21 '13 at 15:00










            • @ChristopherIckes It is a wiki: you can edit your question and include other relevant information...
              – jasonwryan
              Feb 21 '13 at 17:24














            up vote
            3
            down vote



            accepted










            See if the identity file is listed



            ssh-add -l


            If not, add it



            ssh-add ~/.ssh/username 


            Was then able to select the proper identity file






            share|improve this answer
















            • 1




              Was the reason for the problem that the other identities had been loaded by ssh-agent?
              – Hauke Laging
              Feb 21 '13 at 2:31










            • @HaukeLaging if so, this is a piece of information that should be included in the question; ie., that an agent is running...
              – jasonwryan
              Feb 21 '13 at 2:37










            • Yes, the other identities were previously loaded. @jasonwryan, would have included in the question had I known.
              – csi
              Feb 21 '13 at 15:00










            • @ChristopherIckes It is a wiki: you can edit your question and include other relevant information...
              – jasonwryan
              Feb 21 '13 at 17:24












            up vote
            3
            down vote



            accepted







            up vote
            3
            down vote



            accepted






            See if the identity file is listed



            ssh-add -l


            If not, add it



            ssh-add ~/.ssh/username 


            Was then able to select the proper identity file






            share|improve this answer












            See if the identity file is listed



            ssh-add -l


            If not, add it



            ssh-add ~/.ssh/username 


            Was then able to select the proper identity file







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 21 '13 at 2:27









            csi

            193210




            193210







            • 1




              Was the reason for the problem that the other identities had been loaded by ssh-agent?
              – Hauke Laging
              Feb 21 '13 at 2:31










            • @HaukeLaging if so, this is a piece of information that should be included in the question; ie., that an agent is running...
              – jasonwryan
              Feb 21 '13 at 2:37










            • Yes, the other identities were previously loaded. @jasonwryan, would have included in the question had I known.
              – csi
              Feb 21 '13 at 15:00










            • @ChristopherIckes It is a wiki: you can edit your question and include other relevant information...
              – jasonwryan
              Feb 21 '13 at 17:24












            • 1




              Was the reason for the problem that the other identities had been loaded by ssh-agent?
              – Hauke Laging
              Feb 21 '13 at 2:31










            • @HaukeLaging if so, this is a piece of information that should be included in the question; ie., that an agent is running...
              – jasonwryan
              Feb 21 '13 at 2:37










            • Yes, the other identities were previously loaded. @jasonwryan, would have included in the question had I known.
              – csi
              Feb 21 '13 at 15:00










            • @ChristopherIckes It is a wiki: you can edit your question and include other relevant information...
              – jasonwryan
              Feb 21 '13 at 17:24







            1




            1




            Was the reason for the problem that the other identities had been loaded by ssh-agent?
            – Hauke Laging
            Feb 21 '13 at 2:31




            Was the reason for the problem that the other identities had been loaded by ssh-agent?
            – Hauke Laging
            Feb 21 '13 at 2:31












            @HaukeLaging if so, this is a piece of information that should be included in the question; ie., that an agent is running...
            – jasonwryan
            Feb 21 '13 at 2:37




            @HaukeLaging if so, this is a piece of information that should be included in the question; ie., that an agent is running...
            – jasonwryan
            Feb 21 '13 at 2:37












            Yes, the other identities were previously loaded. @jasonwryan, would have included in the question had I known.
            – csi
            Feb 21 '13 at 15:00




            Yes, the other identities were previously loaded. @jasonwryan, would have included in the question had I known.
            – csi
            Feb 21 '13 at 15:00












            @ChristopherIckes It is a wiki: you can edit your question and include other relevant information...
            – jasonwryan
            Feb 21 '13 at 17:24




            @ChristopherIckes It is a wiki: you can edit your question and include other relevant information...
            – jasonwryan
            Feb 21 '13 at 17:24












            up vote
            3
            down vote













            It looks like ssh is trying all the identities it knows about. If you want to only try the identity specified in the config file, add the line



            IdentitiesOnly = yes


            to that Host section of your .ssh/config file.



            Here's the relevant section of the ssh_config man page:




            IdentitiesOnly
            Specifies that ssh(1) should only use the authentication identity files configured in the ssh_config files, even if ssh-agent(1) offers more identities. The argument to this keyword must be ''yes'' or ''no''. This option is intended for situations where ssh-agent offers many different identities. The default is ''no''.







            share|improve this answer
























              up vote
              3
              down vote













              It looks like ssh is trying all the identities it knows about. If you want to only try the identity specified in the config file, add the line



              IdentitiesOnly = yes


              to that Host section of your .ssh/config file.



              Here's the relevant section of the ssh_config man page:




              IdentitiesOnly
              Specifies that ssh(1) should only use the authentication identity files configured in the ssh_config files, even if ssh-agent(1) offers more identities. The argument to this keyword must be ''yes'' or ''no''. This option is intended for situations where ssh-agent offers many different identities. The default is ''no''.







              share|improve this answer






















                up vote
                3
                down vote










                up vote
                3
                down vote









                It looks like ssh is trying all the identities it knows about. If you want to only try the identity specified in the config file, add the line



                IdentitiesOnly = yes


                to that Host section of your .ssh/config file.



                Here's the relevant section of the ssh_config man page:




                IdentitiesOnly
                Specifies that ssh(1) should only use the authentication identity files configured in the ssh_config files, even if ssh-agent(1) offers more identities. The argument to this keyword must be ''yes'' or ''no''. This option is intended for situations where ssh-agent offers many different identities. The default is ''no''.







                share|improve this answer












                It looks like ssh is trying all the identities it knows about. If you want to only try the identity specified in the config file, add the line



                IdentitiesOnly = yes


                to that Host section of your .ssh/config file.



                Here's the relevant section of the ssh_config man page:




                IdentitiesOnly
                Specifies that ssh(1) should only use the authentication identity files configured in the ssh_config files, even if ssh-agent(1) offers more identities. The argument to this keyword must be ''yes'' or ''no''. This option is intended for situations where ssh-agent offers many different identities. The default is ''no''.








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 13 at 17:30









                Brian Minton

                268211




                268211



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f65563%2fchanging-the-order-of-private-keys-passed-via-ssh-login%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay