SSH接続 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! が表示されたら

SSH接続時に、次のような WARNING メッセージが発生したあとにSFTP接続ができなくなりました。

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Please contact your system administrator.
Add correct host key in /Users/user/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/user/.ssh/known_hosts:22
ECDSA host key for 192.168.33.10 has changed and you have requested strict checking.
Host key verification failed.
lost connection

対策

ssh-keygenコマンドでknown_hostsを消すとよい。

ssh-keygen -R <hostname>
ssh-keygen -R 192.168.33.10