Question

Add correct host key in /root/.ssh/known_hosts to get rid of this message

When try to login to remote server from my local machine using terminal I get the following message 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:5 remove with: ssh-keygen -f “/root/.ssh/known_hosts” -R 45.55.154.139 Password authentication is disabled to avoid man-in-the-middle attacks. Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.

I generated rsa key from server by using the following command

ssh-keyscan -t rsa ip_address

```added the rsa key to known_hosts file in my local machine, but still I am getting this issue


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

use this:

ssh-keygen -R SERVER_IP_ADDRESS

perhaps you need to use the correct host key type

grant@outhouse:~[20220830-13:40][#1003]$ ssh-keyscan -t ecdsa 10.1.132.201
# 10.1.132.201:22 SSH-2.0-OpenSSH_8.0
10.1.132.201 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBD8srrJpp08VIkxLg08tK6gEGOWs5xCbeLppb/i8nYGcOXXpGa0UXMqfA8e8L20RtiY905osTH1mGFRSLRgV6ic=
grant@outhouse:~[20220830-13:41][#1004]$

then add this to ~/.ssh/known_hosts

ssh-keygen -f “/home/my_username/.ssh/known_hosts” -R “addr_of_remote_server”