eliminar claves del known_hosts / remove outdated ssh fingerprints keys from known_hosts


Aquí dos métodos para eliminar una clave o fingerprint del known_hosts por línea de comandos:

[hvivani@test ~]$ ssh 10.0.1.145
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
14:7e:6a:1f:c7:7b:ff:c1:df:4f:f7:d1:20:68:54:78.
Please contact your system administrator.
Add correct host key in /home/hvivani/.ssh/known_hosts to get rid of this message.
Offending key in /home/hvivani/.ssh/known_hosts:39
RSA host key for 10.0.1.145 has changed and you have requested strict checking.
Host key verification failed.

1) Con sed:

[hvivani@test .ssh]$ sed -i "39d" /home/hvivani/.ssh/known_hosts

2) Con ssh-key-gen

[hvivani@test .ssh]$ ssh-keygen -R 10.0.1.31

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s