I am creating VMs using Vagrant + VirtualBox + CentOS 6.5 (box). Every time I issue the command vagrant up
and SSH into the VM, I get the following message.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 a host key has just been changed. The fingerprint for the RSA key sent by the remote host is SHA256:VGRuX5IMJOd+PW6T4jo/ONm6D8vClUmVEaSI7j/nWb8. Please contact your system administrator. Add correct host key in /home/root/.ssh/known_hosts to get rid of this message. Offending RSA key in /home/root/.ssh/known_hosts:6 RSA host key for weetube has changed and you have requested strict checking. Host key verification failed.
Please note the following.
- the VM is set to a static IP (e.g. 10.211.55.10)
- the host machine (Windows) has its hosts file modified (e.g. 10.211.55.10 myvm)
- I use cygwin to SSH (e.g. ssh root@myvm)
I also tried bootstrapping by copying /etc/ssh to /vagrant/ssh, and then on VM provision, copied /vagrant/ssh/* back to /etc/ssh, but that does not seem to help.
The only way to get around this message is to (using Cygwin) and delete the entry from myvm
from ~/.ssh/known_hosts. I don't want to do this every time I have to re-create the VM (e.g. vagrant up
).
Any ideas on how to avoid this problem?