Let's say there are two keys A and B, both of which are valid for user@host public key authentication. Since authorized_keys is configured for different behaviour depending on the key, ~/.ssh/config on the client uses something like
Host A.host
HostName host
User user
IdentityFile ~/.ssh/A
Host B.host
HostName host
User user
IdentityFile ~/.ssh/B
That works fine. However, the moment I use ssh-agent and add both keys A and B (e.g. in order to enter their passphrases at login instead of when I call the respective ssh A.host or ssh B.host), the connection will always use the same id for both virtual hosts. Is there any way to specify which stored key ssh should use from ssh-agent without having to remove the other key?
IdentitiesOnly yes. That's also the answer to another question which weirdly ended up on SU... I'll try this tomorrow – Tobias Kienzler Oct 17 '12 at 17:59