Error using amazon EC2 (ubuntu)

I just started using amazon EC2 and I use it through cygwin for windows to start ubuntu. I recently tried logging into my EC2 instance via ssh and I received this error 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... Host key verification failed. 

What is it and how do I do it?

+4
source share
3 answers

This means that the SSH server presents a different RSA key than when connecting to the server for the first time at this IP address. If you change the instance running on this IP address / hostname, this is to be expected.

If this is a completely unexpected error message, this is for your own protection. There is a chance that someone can do something malicious and control the connection.

If you want to override it, go to C:\Users\[your username]\.ssh\known_hosts and delete the violation line that starts with the host name and / or IP address of the SSH server. Then connect to the server.

+4
source

just use

ssh-keygen -R hostname

Example ssh-keygen -R 168.9.9.2

This will update your host violation from known_hosts

+3
source

When you connect to an ssh server, your ssh client stores a list of trusted hosts in the form of key-value pairs for the IP address and fingerprint of the ssh server. With ec2, you often reuse the same IP address with multiple server instances, which causes a conflict.

If you connect to an earlier instance of ec2 with this IP address and now connect to a new instance with the same IP address, your computer will complain of a “Host Verification Error” because its previously saved pair no longer matches the new pair.

The error message tells you how to fix it:

for example: RSA key violation in /home/ubuntu/.ssh/known_hosts:1 remove with: ssh-keygen -f "/home/ubuntu/.ssh/known_hosts" -R

just open /home/ubuntu/.ssh/known_hosts and delete line 1 (as indicated by ": 1").

Now you can connect and get a new host check

0
source

Source: https://habr.com/ru/post/1490294/


All Articles