Or little computing tricks and hacks
Monthly Archives: August 2016
August 1, 2016Posted by on
Edit August 6, 2016
The solution I gave back in August 1, 2016 does not work. That rule will simply not offer any keys.
I found this post which refers to the pitfalls of ssh-agent, and it decribes that it is a problem having too many keys. It depends on the setting of the server to allow a specific number of keys offered before refusing access.
There is also a ssh argument force using a specific key.
In my previous post Managing multiple ssh keys, I describe how to set up different ssh keys to different server and have the ssh command automatically discover which key to user for which (user, server) combination.
However, when I had a new server, if the key was not in the ~/.ssh/config file (se previous post), I would experience the follow:
ssh username@server Received disconnect from server_ip port 22:2: Too many authentication failures Connection to server closed by remote host. Connection to server closed.
Looking around there were many explanations:
- That there is a limit on the number of keys offered to the server (true)
- That I ( could check what is happening by adding the -v flag to the ssh command (true)
- That I should add the line IdentitiesOnly yes to every definition in the ~/.ssh/config file (true but not enough)
I still had the problem.
The final solution was to add the line IdentitiesOnly yes to the /etc/ssh/ssh_config under Host *. The enlightenment came from this post.