Duplicate entries are added to known_hosts file on every login

known-hosts

I have .ssh/config file in this format:

Host ABC
Hostname example.com
HostKeyAlias ABC
CheckHostIP yes
StrictHostKeyChecking no
Port 1001
User userABC

Host CDE
Hostname example.com
HostKeyAlias CDE
CheckHostIP yes
StrictHostKeyChecking no
Port 1002
User userCDE

The hostname is the same but based on PORT# the firewall redirects the access to the correct predefined host.
Everything is working except:

  1. Warning: Permanently added 'ABC,example.com' (RSA) to the list of known hosts.
    this happens every single time
  2. known_hosts files is keep on growing with duplicate entries

I don't mind the Warning itself, but I don't want the known_hosts file to grow with redundant entries!

Best Answer

Have you tried with CheckHostIP set to no?

I found a similar issue, and I'm just throwing this out as a thought. I'd have to setup a test to try this out, because I'm really curious now what's going on.

https://stackoverflow.com/questions/733753/how-to-handle-ssh-host-key-verification-with-2-different-hosts-on-the-same-but

Related Topic