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.
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?
I don't know how to make the fingerprint remain the same when rebuilding your VM. However, you can setup your ssh config to ignore the fingerprint (for your VM only!)
In: ~/.ssh/config (i'm using macOS, ssh config file may be located elsewhere in other systems):
Host [IP of your VM]
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
IdentityFile ~/.vagrant.d/insecure_private_key
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With