12
I have a server (lets assume its ip be a.b.c.d) which allows users to login via ssh. Now I want to change the physical machine keeping the ip same. So that the new machine is still accessed by a user like this
$ssh a.b.c.d
Problem is, every time one user tries to login, she gets the following ssh-key mismatch error.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is 02:dc:c6:18:1b:34:b7:1d:fa:90:ab:e1:95:48:69:84. Please contact your system administrator. Add correct host key in /home/user/.ssh/known_hosts to get rid of this message. Offending key in /home/user/.ssh/known_hosts:37 RSA host key for alumni has changed and you have requested strict checking. Host key verification failed.
I know that user can delete line # 37 from the file ~/.ssh/known_hosts and next time she would get a yes/no prompt. What I want is that user should be kept unaware of this whole machine replacement thing and just get a prompt for password.
How to do that?
3I agree with Matt. If you're in control of both machines and therefore the owner of the keys, moving the host key from one machine to another within your control IS NOT a man in the middle attack or risk. If the connecting user trusts your host key, it shouldn't matter. – Ross – 2015-03-09T13:16:45.670
3Are you aware that this would defeat
ssh
's only protection against man in the middle attacks and could result in you sending your password right to the attacker instead of the intended machine? Unless you know for a fact that you are invulnerable to active attacks (for example, you are on the same secure internal network as the target machine) this destroysssh
's security model. – David Schwartz – 2013-01-10T15:25:08.887Yes. Both the machines are in the same internal networks. Even the users are inside the same internal network. Given this situation, what are my options? – Souvik Pal – 2013-01-10T16:07:05.043
That's not enough. They have to be in the same secure internal network. That is, they must absolutely, 100% trust that no device is connected to that internal network that is not 100% secure, and they must 100% trust everyone who has control over those devices or can attach a device to that network. In other words, in almost any realistic scenario, this is a bad idea. – David Schwartz – 2013-01-10T16:53:34.073
2It's a perfectly reasonable thing to do. I'm replicating the ssh server keys to another server for HA so that when I login I'm getting those errors. Besides I get emailed on failover. – Matt H – 2013-12-12T02:35:44.057