Jeżeli podczas połączenia przez SSH pojawia się komunikat jak powyżej to należy:

  1. Wyedytować plik known_hosts w swoim katalogu domowym i usunąć wskazany w komunikacie wiersz.
  2. Wykonać polecenie ssh-keygen -R "you server hostname or ip" usuwające błędny wiersz.

Poniżej przykład usunięcia wiersza za pomocą polecenia.

# ssh -p 22222 user@192.168.22.1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
c0:fc:40:e0:e1:60:58:05:90:25:ca:09:ce:80:d1:0f.
Please contact your system administrator.
Add correct host key in /home/zdalny/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/zdalny/.ssh/known_hosts:33
RSA host key for [192.168.22.1]:22222 has changed and you have requested strict checking.
Host key verification failed.
zdalny@frega1:~$ ssh-keygen -R [192.168.22.1]:22222
/home/zdalny/.ssh/known_hosts updated.
Original contents retained as /home/zdalny/.ssh/known_hosts.old
# ssh -p 22222 user@192.168.22.1
The authenticity of host '[192.168.22.1]:22222 ([192.168.22.1]:22222)' can't be established.
ECDSA key fingerprint is 30:44:cc:12:7c:9b:66:ac:77:5a:c5:67:13:f9:82:93.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.22.1]:22222' (ECDSA) to the list of known hosts.