HostOnNet Blog

Remove a servers key fingerprint from known_hosts

I was creating a program that login to remove server using PHP and run some commands. The servers key fingerprint was already on my known_hosts file. To verify script still work with out the fingerprint in known_hosts, i want to try on an unknown server or remove the fingerprint from known_hosts, this is done with command

ssh-keygen -R REMOTE_SERVER_IP


$ ssh-keygen -R
# Host found: line 495
/home/boby/.ssh/known_hosts updated.
Original contents retained as /home/boby/.ssh/known_hosts.old
$ ssh root@
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:6sCKwFic2Absb5C3msA9FEl8zunzj5kWMDYI2bPU/SU.
Are you sure you want to continue connecting (yes/no)? ^C

Posted in Linux