The error "Warning: Remote Host Identification Has Changed" commonly occurs when the SSH client detects a change in the host key of the remote server. This can happen for various reasons, such as the server being reinstalled or SSH keys being regenerated. This warning is a security feature that notifies you that the identity of the remote host may have changed, which could indicate potential security risks, like a man-in-the-middle attack.
Here are ways to resolve this error:
Method 1: Remove Old Entry
1) Locate and Open the Known Hosts File:
On your local machine, the known hosts file is usually located in the ~/.ssh/ directory. Open it with a text editor.
nano ~/.ssh/known_hosts
Look for the line corresponding to the remote host causing the warning. Each line in this file represents a different host and may look like this:
alamat_ip_server_remote ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD...
Remove the entire line for the remote server causing the warning.
Method 2: Use SSH Key Fingerprint
1) Check SSH Key Fingerprint:
If you have access to the remote server, check the SSH key fingerprint on the server side.
ssh-keygen -l -E md5 -f /etc/ssh/ssh_host_rsa_key.pub
2) Update Local Known Hosts:
Manually add the correct fingerprint to your local known_hosts file.
ssh-keyscan -H -t rsa remote_server_ip >> ~/.ssh/known_hosts
3) Try Reconnecting:
Attempt to connect to the remote server using SSH. The warning should not appear if the fingerprint matches.
Method 3: StrictHostKeyChecking
ssh -o StrictHostKeyChecking=no user@remote_server_ip