ssh keeps asking for confirmation although the server key is in the known_hosts file when there is another conflicting key in that file

Solution Verified - Updated -

Issue

When sshing to a system from Red Hat Enterprise Linux it asks "are you sure you want to continue" at every login and you need to type in "yes" every time. For example:

$ ssh -l root my-ssh-server
Warning: the RSA host key for 'my-ssh-server' differs from the key for the IP address '10.0.0.1'
Offending key for IP in /root/.ssh/known_hosts:133
Matching host key in /root/.ssh/known_hosts:144
Are you sure you want to continue connecting (yes/no)?

You want for ssh to log in without user interaction. Installing the key from the server into ~/.ssh/known_hosts as per http://kbase.redhat.com/faq/docs/DOC-9195 doesn't resolve the issue.

Environment

RHEL 3, 4, 5 or 6 on the ssh client side

the server key is in the ~/.ssh/known_hosts file

another key for the same server is in the ~/.ssh/known_hosts file

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content