これもよく知られていることと思われますが,自分への備忘録として.
VirtualBox で何度めかに CentOS 7 の仮想マシンを作成.
【環境】
- Mac
- VirtualBox Version 5.0.32 r112930
- CentOS-7-x86_64-Minimal-1511.iso
【参考サイト】
yk5656 diary: VirtualBoxにCentOS7をインストールしてみる
作成後にホストの Mac から SSH を試みると,
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
の警告メッセージ.
mac$ ssh developer@192.168.56.101
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
SHA256:t***M.
Please contact your system administrator.
Add correct host key in /Users/hoge/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/hoge/.ssh/known_hosts:5
ECDSA host key for 192.168.56.101 has changed and you have requested strict checking.
Host key verification failed.
解決策はいくつかあるようだが,stack overflow 記事から
ssh remote host identification has changed
ssh-keygen -R <host>
を実行.
mac$ ssh-keygen -R 192.168.56.101
# Host 192.168.56.101 found: line 5
/Users/hoge/.ssh/known_hosts updated.
Original contents retained as /Users/hoge/.ssh/known_hosts.old
再度 SSH を試みて,
mac$ ssh developer@192.168.56.101
The authenticity of host '192.168.56.101 (192.168.56.101)' can't be established.
ECDSA key fingerprint is SHA256:t***M.
Are you sure you want to continue connecting (yes/no)?
yes と答え,
Warning: Permanently added '192.168.56.101' (ECDSA) to the list of known hosts.
developer@192.168.56.101's password:
PW 入力で,接続〜ログインできた.