I would like keychain access to store all my keys and passwords for my ssh accesses.

However, if I store too many keys, I get "Too Many Authentication Failures" since SSH will try to send all keys and passwords.

Is there a way to choose which key or password to send?

  • So you're saying that for one SSH-connection ssh <user>@<hostname> you have multiple passwords stored in your keychain? Shouldn't you only have one password for one user, or am I misunderstanding your question? Other than that could you maybe post the output of ssh -vvv <username>@<hostname> (after redacting all sensitive information like actual hostnames out of it)? This could help debug your session. – Asmus Jun 25 '14 at 13:31
  • @Asmus Perhaps I didn't make myself clear. In my keychain, I have keys and passwords which will log to one single ssh <user>@<hostname>. That said, when trying to authenticate, ssh will send ALL keys (in sequence) before trying password authentication. If you have too many keys, you will eventually get the error above, not giving keychain the chance to try any stored password. – Pbal Jun 26 '14 at 2:03

Put your per-server SSH-configuration into ~/.ssh/config like this:

Host useKeyOnly.net
user sshuser 
Identityfile ~/.ssh/mykey1
IdentitiesOnly yes

Host usePasswordOnly.org
PubkeyAuthentication no
Port 53221
user root
| improve this answer | |
  • 1
    I was aware of this configuration option and thanks for the input. I was just hoping that I would be able to do without fiddling with ~/.ssh/config, since using keychain access is a very neat way to do without storing stuff in ~/.ssh ... ;) – Pbal Jul 3 '14 at 2:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .