さくらVPSの初期化後に『SSHでエラーが出た場合』の対処法
さくらVPSを初期化してSSHログインをしようとしたらエラーが…。
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 xx:xx:xx:xx:xx:xx:xx:xx Please contact your system administrator. Add correct host key in /Users/"ユーザー名"/.ssh/known_hosts to get rid of this message. Offending key in /Users/"ユーザー名"/.ssh/known_hosts:4 RSA host key for "サーバーIP" has changed and you have requested strict checking. Host key verification failed.
「ハッキングされたかな\(^o^)/」とかおもいつつ、ググるとすぐに答えがありました。
ターミナルで以下のコマンドを実行します。
ssh-keygen -R "サーバーIP"
その後、SSHのコマンドを以下のように入力。
$ssh "ユーザー名"@"サーバーIP"
すると以下の警告がでますが、「Yes」でおっけい。
The authenticity of host ' "サーバーIP" ("サーバーIP")' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
これで完了です。
めでたくSSHログインできるようになりました\(^o^)/
※PS(2026年9月3日):最近は「新規ブログ」で発信しています。