SSH: remote host identification has changed!: copertina

Come ripristinare la connessione se abbiamo questo errore.

Si tratta di un problema bloccante per le connessioni ssh per qualsiasi client usiamo (da Linux, da MobaXterm, PuTTY, Mac OS, ecc...).
Il problema è causato da un cambio nel server a cui ci stiamo collegando; la firma digitale dell'istanza ssh server è cambiata.

Questo può essere sinonimo di un attacco o di aggiornamenti che hanno comportato la rigenerazione del fingerprint.

Se il nostro caso è il secondo ecco come fixare.

Sintomi

Se nel dare il nostro solito comando di connessione ssh otteniamo un errore come il seguente

ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)!
ERROR: It is also possible that a host key has just been changed.
ERROR: The fingerprint for the ED25519 key sent by the remote host is
ERROR: SHA256:o3L8XlonoSHKF8EP/0tIbUemvbwCXKPxvrSuFbuisfM.
ERROR: Please contact your system administrator.
ERROR: Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
ERROR: Offending ED25519 key in /home/user/.ssh/known_hosts:504
ERROR:   remove with:
ERROR:   ssh-keygen -f "/home/user/.ssh/known_hosts" -R "server.example.com"
ERROR: Host key for server.example.com has changed and you have requested strict checking.
ERROR: Host key verification failed.

per sistemare è sufficiente date il seguente comando come scritto nel messaggio stesso

ssh-keygen -f "/home/user/.ssh/known_hosts" -R "server.example.com"

Quindi ridiamo il comando di connessione e vedremo che la connessione verrà creata in un istante.