Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

さくらVPS再インストールしたらSSH接続できなくなった

More than 3 years have passed since last update.

さくら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 a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
xxxxxxxxxxxxxxxxxxxxxxx
Please contact your system administrator.
Add correct host key in /Users/ユーザー名/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/ユーザー名/.ssh/known_hosts:59
ECDSA host key for サーバーIP has changed and you have requested strict checking.
Host key verification failed.

これは、OS再インストール前に設定していた鍵認証が、残っている為に出る警告らしい。
なのでknown_hostsファイルから鍵を取り除く。
(ってかWARNINZGはホント心臓に悪い(>_<)汗)

known_hostsから鍵をすべて取り除く

$ ssh-keygen -R "サーバーIP"

その後はrootユーザーでSSH接続

$ ssh root@サーバーIP

そうすると接続してもいいか聞かれるので、もちろん yes

The authenticity of host 'サーバーIP (サーバーIP)' can't be established.
ECDSA key fingerprint is xxxxxx.
Are you sure you want to continue connecting (yes/no)? 

そしたらさくらVPSの初期設定作業に入ります。
おわり。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away