SSHexit code > 0

Host key verification failed

$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! ... Host key verification failed.

Analysis

The host key stored in your known_hosts file doesn't match the key provided by the server.

Common Triggers

  • The server was reinstalled or the SSH keys were regenerated.
  • A Man-in-the-Middle (MITM) attack might be occurring.
  • You are connecting to a different host that now has the same IP address.

Debug Checks

  • $Verify if the server was recently updated or reinstalled.

Resolution

1
Remove the old key: ssh-keygen -R <hostname_or_ip>.
2
Manually edit ~/.ssh/known_hosts and delete the offending line.