h1

Borrar una linea en el fichero known_hosts

16 Junio, 2008

Si has reinstalado el sistema operativo en un servidor, o le has cambiado la ip, seguramente cuando vuelvas a intentar acceder a la máquina por ssh te impedirá el acceso y recibiras un mensaje como este:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
b1:3b:85:a5:b3:ab:37:a9:6d:3e:98:7a:d5:9d:78:15.
Please contact your system administrator.
Add correct host key in /home/jacobo/.ssh/known_hosts to get rid of this message.
Offending key in /home/jacobo/.ssh/known_hosts:240
RSA host key for 29.23.11.34 has changed and you have requested strict checking.
Host key verification failed.

La solución es eliminar la linea número 240 del fichero known_hosts, puedes hacerlo con un editor de texto, pero es mas cómodo teclear lo siguiente:

ssh-keygen -R hostname|ip

Si no has tocado nada, ten cuidado, puede que alguien este intentando acceder a tu servidor con técnicas man in the middle.

4 comentarios

  1. O también puedes entrar en el fichero y borrar la línea que tiene la entrada, IP, del servidor al que quieres entrar….y así será como si entraras por primera vez…


  2. [...] Borrar una linea en el fichero known_hosts « robot plays guitar (tags: ssh unix) [...]


  3. Me ha venido genial hoy mismo este consejo… gracias master!


  4. sed -i Xd .ssh/known_hosts

    Donde X es el número de la linea a borrar



Deja un comentario