0

I was normally working with the SSH on my server, then disconnected to re-connect using a different keypair, but received this message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @
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:****. Please contact your system administrator. Add correct host key in /home//.ssh/known_hosts to get rid of this message. Offending ECDSA key in /home//.ssh/known_hosts:4 remove with: ssh-keygen -f "/home//.ssh/known_hosts" -R ec2-.us-east-2.compute.amazonaws.com ECDSA host key for ec2-**.us-east-2.compute.amazonaws.com has changed and you have requested strict checking. Host key verification failed.

I insisted and didn't work. Deleted the known host and didn't work.

Now the old keypair doesnt work either if i try to connect to ubuntu@ec2-**.us-east-2.compute.amazonaws.com. The new error is

Permission denied (publickey).

The only way to connect is directly using the public IP. I tried flushing the DNS cache and nothing. What could've happened?

  • Similar questions at stackexchange.com/…, possibly some of them might address the question of why an Amazon host's identification might have changed – mwfearnley Apr 4 '18 at 11:21
  • I tried deleting all known_hosts and it didn't work. It says "Permission denied (publickey)". – Motheus Apr 4 '18 at 16:29
  • The only way is connecting to the public IP. Get access denied every time when using the amazon domain. – Motheus Apr 4 '18 at 16:47
1

You have a cached host key for that hostname in your ~/.ssh/known_hosts file. Did you previously connect to a host with this same name, but then replace the instance?

Either remove your ~/.ssh/known_hosts file entirely, or remove the entry for the hostname from the file in an editor.

  • I tried this: "Deleted the known host and didn't work. ". The error after the first one is "Permission denied (publickey)." – Motheus Apr 4 '18 at 16:28
  • The only way is connecting to the public IP. Get access denied every time when using the amazon domain. – Motheus Apr 4 '18 at 16:47
  • 1
    Are you connecting to the correct hostname? If the public IP has changed, the DNS will also change. – Jason Floyd Apr 5 '18 at 7:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.