Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
ssh -i ~/.ssh/username username@xx.xx.xx.xxx -v

Server is set to accept only 3 log on tries. The ssh system is trying 3 identity files before attempting the correct identity file.

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 3 incorrect identity files? I have already tried deleting them from the directory.

I have also tried updating ~/.ssh/config

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

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

share|improve this question
up vote 1 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
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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