Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is the case, we have successfully configured SSH keys (and hence password-less SFTP connection) between ProdServer-A to ProdServer-B. It works, or so I thought still yesterday. Yesterday ProdServer-B failed over to DisasterServer-B. When it did, the SSH connection failed.

In ProdServer-A we get an alert saying ProdServer-B has changed (known-hosts) and could be "man-in-middle" attack (which is as expected, but we know why this is happening). So, my question is, how can we add keys from two servers (same hostname, but only one active at a time) into known_hosts?

Or even better, how can we successfully avoid SSH connection failures if a production server failed over to disaster server? Suggestions are welcome. Thanks!

share|improve this question
There may be quite a few ways that a SSH connexion fails (mostly, due to physical network outages). Think your setup should really tolerate such disruptions (by re-establishing the link). – Deer Hunter Mar 20 '13 at 4:43
up vote 2 down vote accepted

If DisasterServer-B is meant to function as a clone of ProdServer-B, including using the same IP address, then I think you can just duplicate the host keys from ProdServer-B to DisasterServer-B as well. One caveat is that if the private key of one is compromised, then a MTM attack could be launched against the other. But I wouldn't expect this to be a huge concern, if they contain the same data anyway.

If it is, then you may have to look into using x509 PKI.

share|improve this answer
+1. Thanks for the suggestion. I will wait for other options. :) – Guru Mar 19 '13 at 22:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.