Linux/공통

ssh 원격 접속 에러(WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!)

bong2. 2021. 11. 1. 15:20

간혹 ssh 원격 접속 시 아래와 같은 오류 메시지가 뜨며 접속 실패하는 경우가 있다.

[root@localhost ~]# ssh root@{IP}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:Zu5tNyx0BgVrAHbjSPosyvJN4xmybLx2zfAvo4Qyx3Y.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:60
ECDSA host key for {IP} has changed and you have requested strict checking.
Host key verification failed.

해결 방법은 간단하다.

ssh-keygen -R [ IP or DomainName]

위 명령어를 수행하여 ssh-keygen을 초기화 삭제한 후 ssh 원격 접속을 재시도하면 정상 접속됨을 확인 가능하다.