6

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?

3

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''.

2

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

4
  • 1
    Was the reason for the problem that the other identities had been loaded by ssh-agent? 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.