🖥

#AWS ElasticBeanStalk サーバー への ssh 接続で Host key verification failed. ER

に公開
2023/08/29

エラー

  • AWSに限らずよくあるフィンガープリント違うってやつ
  • AWSで環境更新した後にIPアドレスは同じだけどサーバー自体は更新されているのでエラーが出るとか?
$ eb ssh
INFO: Attempting to open port 22.
INFO: SSH port 22 open.
INFO: Running ssh -i /Users/yumainaura/.ssh/pup.pem ec2-user@XXX.XXX.XXX.XXX
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Please contact your system administrator.
Add correct host key in /Users/yumainaura/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/yumainaura/.ssh/known_hosts:1
ECDSA host key for XXX.XXX.XXX.XXX has changed and you have requested strict checking.
Host key verification failed.
ERROR: CommandError - An error occurred while running: ssh.

対策

ローカル環境の known_hosts で該当のIPアドレスの行を消して保存する

$ vim ~/.ssh/known_hosts

そんなサーバー知らねえよ!

俺達の関係はやり直しだ!って状態にする。

やり直し

フィンガープリントあーゆーおーけー?って効かれるのでYES!YES!YESって応える

$ eb ssh
INFO: Attempting to open port 22.
INFO: SSH port 22 open.
INFO: Running ssh -i /Users/yumainaura/.ssh/pup.pem ec2-user@XXX.XXX.XXX.XXX
The authenticity of host 'XXX.XXX.XXX.XXX (XXX.XXX.XXX.XXX)' can't be established.
ECDSA key fingerprint is SHA256:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'XXX.XXX.XXX.XXX' (ECDSA) to the list of known hosts.
Last login: Sat Nov  9 00:51:57 2019 from YYY.YYY.YYY.YYY
 _____ _           _   _      ____                       _        _ _
| ____| | __ _ ___| |_(_) ___| __ )  ___  __ _ _ __  ___| |_ __ _| | | __
|  _| | |/ _` / __| __| |/ __|  _ \ / _ \/ _` | '_ \/ __| __/ _` | | |/ /
| |___| | (_| \__ \ |_| | (__| |_) |  __/ (_| | | | \__ \ || (_| | |   <
|_____|_|\__,_|___/\__|_|\___|____/ \___|\__,_|_| |_|___/\__\__,_|_|_|\_\
                                       Amazon Linux AMI

This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH
WILL BE LOST if the instance is replaced by auto-scaling. For more information
on customizing your Elastic Beanstalk environment, see our documentation here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
[ec2-user@ip-ZZZ-ZZZ-ZZZ-ZZZ ~]

怪しく光るAWSとフィンガープリントの世界へようこそ

指紋...つけた...?

image

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/2690

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-11-09

Discussion