@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for foo-bar.net has changed,
and the key for the corresponding IP address 127.0.0.1
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /home/user/.ssh/known_hosts:6
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

ssh 키가 안 맞는다고 뱉는 경우.

6번째 줄에 어느 줄의 키가 안 맞는지 적혀있으니 직접 ~/.ssh/known_hosts 파일을 열어서 수정해도 되겠지만 귀찮으니 파일을 열지 않고 해결할 수 있는 방법을 알고 싶었다.

man ssh-keygen

-R hostname

Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).

말인즉슨 ssh-keygen -R 대충호스트네임 을 입력해서 충돌하는 키를 지울 수 있다고 한다. 다만 이 경우 같은 호스트네임을 모두 지운다. 포트가 있을 경우 반드시 괄호를 칠 것 [localhost]:portnumber.

via StackOverflow