After reinstalling my server Linux, I was no longer able to add the ssh key to the list of known_host files. And the reason behind it, was that I had also upgraded my client computer to a newer version; however, it didn’t retain the appropriate credentials for the know_host files which already existed. So basically it comes down to taking ownership of that file, so you don’t keep getting that prompt asking for adding of ssh key of remote server. Here’s the complete error description, as well as the command to permanently add the key
Here’s the annoying message
ssh email@example.com The authenticity of host '192.168.100.10 (192.168.100.10)' can't be established. ECDSA key fingerprint is 7f:2f:7a:83:a6:ad:9b:6c:7b:bb:36:16:a8:23:f4:ce. Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/home/imuser/.ssh/known_hosts)
Here’s how to add the key to host: Take ownership of file, and login once more.
sudo chown -v $USER ~/.ssh/known_hosts [sudo] password for jorge: changed ownership of ‘/home/jorge/.ssh/known_hosts’ from root to jorge
now login and when prompted for adding the key, enter (yes)