LoginSignup
7
3

More than 5 years have passed since last update.

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

Last updated at Posted at 2017-04-02

さくら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の初期設定作業に入ります。
おわり。

7
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3