OSの日記

通信に関する研究をする学生A

EC2インスタンスの建て直し時におけるワーニングの消し方

 

EC2インスタンスを初期化したく,同じIPアドレスで建て直したら次のような警告が出た.

 

あるサーバから別のサーバにsshログインする時に警告が出て,接続できなかったのでその時のメモ

後で綺麗に修正します.

 

[ec2-user@ip-10-0-1-10 ~]$ ssh -i my-key.pem.txt ec2-user@10.0.2.10
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:cRI3E5b+apnJPRvtZHTvGl21L6ACPcyj81h72G/wj1I.
Please contact your system administrator.
Add correct host key in /home/ec2-user/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/ec2-user/.ssh/known_hosts:1
ECDSA host key for 10.0.2.10 has changed and you have requested strict checking.
Host key verification failed.

 

ssh-keygen -R 10.0.2.10をしてあげる

[ec2-user@ip-10-0-1-10 .ssh]$ ssh-keygen -R 10.0.2.10
# Host 10.0.2.10 found: line 1
/home/ec2-user/.ssh/known_hosts updated.
Original contents retained as /home/ec2-user/.ssh/known_hosts.old

 

これでできた!!!

 

参考

qiita.com