Supprimer une entrée SSH du fichier known_hosts

En vous connectant en SSH à une machine que vous venez de réinstaller, vous risquez d’avoir le message suivant sur le poste client :

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
f6:fe:f0:1c:4c:25:96:f9:08:8f:97:02:60:90:38:8e.
Please contact your system administrator.
Add correct host key in /Users/Alexis/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/Alexis/.ssh/known_hosts:9
RSA host key for 192.168.1.20 has changed and you have requested strict checking.
Host key verification failed.

C’est juste parce que la clé à changer suite à la réinstallation. Vous devez exécuter la commande ci-dessous pour supprimer l’ancienne clé du fichier known_hosts.

ssh-keygen -R NomDuServeur

A la place du nom du serveur, vous pouvez aussi utiliser l’adresse IP.

Attention, si vous n’avez fait aucune modification sur votre serveur, vous êtes peut-être victime d’une attaque Man in the middle.

Laisser un commentaire

This site uses Akismet to reduce spam. Learn how your comment data is processed.