2017年11月30日木曜日

SSHでサーバに接続できない場合

あまプロではリモートのサーバへ接続してお仕事する案件が有ります。

SSHでリモートサーバへ接続すると、初回に

The authenticity of host 'サーバのIP' can't be established.
RSA key fingerprint is SHA256:**********************************************************
Are you sure you want to continue connecting (yes/no)?
と訊かれます。
ほんまにサーバに接続して良いならyesを入力します。すると
Warning: Permanently added 'ホストのIP' (RSA) to the list of known hosts.







サーバ(の公開鍵)が登録され、次回から公開鍵が一致すれば、訊かれる事はなくなります。

所が、サーバの再インストールや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 a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:****************************************************************
Please contact your system administrator.

そんな時は
  remove with:
  ssh-keygen -f "/home/ローカルユーザ/.ssh/known_hosts" -R "サーバのIP"
メッセージ通りに一旦登録を削除すると良いです。

0 件のコメント:

コメントを投稿

つっこみ