본문 바로가기

카테고리 없음

Remote host identification has changed 에러

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:cZCRJMFfu8/SMkKql4svArBSjoUMUrADIuQeMLxYkVk.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/user/.ssh/known_hosts:14
  remove with:
  ssh-keygen -f "/home/user/.ssh/known_hosts" -R "(ip)"
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.

ssh 접속 시 위와 같은 에러를 마주할 때가 있다.

먼저 발생 원인은 다음과 같다.
 - 호스트와 서버의 IP는 변하지 않은 상태에서 한 쪽이 ssh나 os 재설치 등 초기화가 진행된 경우

ssh 접속은 최초 접속 시 상호간 인증 과정을 진행한다.
이후 최초 인증 시 진행했던 상호 인증을 바탕으로 연결을 수립하게 된다.
그 과정에서 한 쪽이 초기화가 진행되면 나머지 한 쪽은 인증정보를 가지고 있으나 같은 IP임에도 인증정보가 없는 호스트와 연결 시 경고를 주는 것이다.

해결법으로는

rm ~/.ssh/known_hosts

로 인증 정보를 초기화시켜주거나

ssh-keygen -R (target ip)

위 명령어로 인증정보를 갱신해주는 방법 등이 있다.