SSH How to ignore checking IdentityFile

amazon ec2sshssh-keys

I have setup a config file located at "~/.ssh/config" which contains some IdentityFile lines to point to the key files that I use for some of my servers.

e.g. IdentityFile ~/Data/Keys/KeyFile.pem

This works fine when I want to connect to my servers on ec2 which require a key file for authentication.

When I want to connect to a server that does not use a key file and requires a password ssh tries to use my key files in ~/.ssh/config and the connection fails with:

Received disconnect from host.ip: 2: Too many authentication failures for root

Is there a ssh command argument that I can use to connect to this server so that ssh does not try to use my identity files?

Best Answer

You should be able to limit the use of the IdentityFile lines to your EC2 host with the host statement:

Host YourEC2host.com 
    IdentityFile ~/Data/Keys/KeyFile.pem

For more information, see the section about the host section in the ssh_config man page.