My client is mac os x 10.9.5. I have a bastion host (linux) that I am ssh'ng into. I have agent forwarding working so I can ssh to the bastion host and then ssh into another machine without having to store my private key on the bastion.
My problem is I have hit 7 keys in my ssh store (ssh-add -L) on my client machine. When I try to use agent forwarding for machines with the 7th key, it fails for "Too many authentication failures for '. With -vvv on, I can see that in the send_pubkey_test that it gets to the 6th key offered and that is when it stops. 7th key is never offered up. Below is snippet of the 6th key and failure.
- debug3: send_pubkey_test
- debug2: we sent a publickey packet, wait for reply
- debug1: Authentications that can continue: publickey
- debug1: Offering RSA public key: xxxx.pem
- debug3: send_pubkey_test
- debug2: we sent a publickey packet, wait for reply
- Received disconnect from 10.0.1.240: 2: Too many authentication failures for ec2-user
I have tried various solutions but I must be missing something.
On client I am using a config file. In this the bastion host is set the following:
host jump01
ForwardAgent yes
Hostname www.example.com
User some-user
IdentityFile bastion.pem
IdentitiesOnly yes
I have tried setting up the other servers in the client in the config file. Below is the example. When on the bastion server, I try ssh internal.IP and it fails "too many authentication:"
host internal.IP
IdentityFile key.pem
IdentitiesOnly yes
I have tried setting up a config on the bastion server to force it to use and identities file. But since I do not want my private key out there, this fails.
In addition, I tried taking the public key for the pem and copied it to the bastion server in the .ssh directory. Then used -i name.pub on the command line. This did not work. It seemed to treat the pub key as a pem.
My workaround is to write a script to load/delete the keys as I need them. I keep thinking for ssh agent forwarding, there must be a solution that I am missing.
Appreciate any guidance.