ssh -i option does not work properly with ssh-agent

Stephen Harris
Sun, 15 Mar 2015 15:04:13 -0000

On Sun, Mar 15, 2015 at 03:48:30PM +0100, Jens Stimpfle
wrote:
> I noticed that the ssh -i <keyfile> option is "ignored" in
my case:

[...]

> As you can see, when A is loaded in ssh-agent but B isn't, the
> connection is made with key A even when B is specifically requested.

You didn't specify "only use B"

     IdentitiesOnly
             Specifies that ssh should only use the authentication identity
             files configured in the ssh_config files, even if the ssh-agent
             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".


--

rgds
Stephen