Macのターミナル使用中、SSHでこんなエラーが出た時の対処法
MinecraftのサーバーをさくらVPSで運用してますしょーりんですどうも。
今回、MBAのターミナルを使用してSSHでサーバーに接続し、サーバー管理というかworldディレクトリの削除をしようとしました。しかし、サーバーを再インスコしてからMacのSSHでログインをしておらず、下記のようなエラー表示が出ました。
$ssh "ユーザー名"@"サーバーIP"
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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.
さてこんな時どうしよう、と登場したのはもちろんGoogle先生です。
ググった結果、まんじろーさんの記事を発見。ここを参考にさせてもらい、解決させて頂きました。
ということでこの対処法を解説します。
まず、ターミナルで下記のコマンドを実行します。
ssh-keygen -R "サーバーIP"
その後、いつも通りにsshのコマンドを叩いて貰えれば
$ssh "ユーザー名"@"サーバーIP"
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
という表示が出ます。(yes/no)?と聞かれていますが、「信頼性ないけどこのまま接続しても大丈夫?」って感じで聞かれてるだけなのでyesで大丈夫です。
yesを入力、エンターをッターンで下記の表示へ。
Warning: Permanently added ' "サーバーIP" ' (RSA) to the list of known hosts.
"ユーザー名"@"サーバーIP"'s password:
この後から、いつも通りにsshコマンドを使用してもらえればいつも通りに使用することができます。これで作業!ばんざーい!
一方、私は課題一杯なう+2/15から期末テストなので忙しすぎワロリッシュ...さようなら...