Milk-V Duoのイメージファイルの更新などをしていたら、SSH接続時にHost key verification failedというエラーメッセージが出ました(以下のようなメッセージ)。ホストキーの検証に失敗しました!というわけで、ホストキーを変更する作業をしようと思います。
PS C:\Users\xxxxx> ssh root@192.168.42.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 ED25519 key sent by the remote host is
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Please contact your system administrator.
Add correct host key in C:\\Users\\xxxxx/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in C:\\Users\\xxxxx/.ssh/known_hosts:1
Host key for 192.168.42.1 has changed and you have requested strict checking.
Host key verification failed.
メッセージにある「C:\\Users\\xxxxx/.ssh/known_hosts」をみてみると、エラーの出てる192.168.42.1の情報が書かれていました。その行を削除しました。
または、以下のコマンドを実行します。
ssh-keygen -R 192.168.42.1
もう一度、SSH接続してみると以下のようなメッセージが出ました。
PS C:\Users\xxxxx> ssh root@192.168.42.1
The authenticity of host '192.168.42.1 (192.168.42.1)' can't be established.
ED25519 key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
[yes]をしてみて、もう一度、SSH接続してみるとログインできました。
PS C:\Users\xxxxx> ssh root@192.168.42.1
root@192.168.42.1's password:
[root@milkv-duo]~#