Another day, another Linux error.
Linux server management is fun – I mean, it’s really fun. But once in a while, you may face some problems and errors. But you know, those errors are letters from your computer. Just enjoy and take advantage of the challenges.
Here’s another note-for-myself blog post. When I tried to ssh-access one of my virtual Linux servers on VirtualBox, I got this error “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!”. But when I googled it, I quickly got the solution, and here’s how I did it.
The Error:
So… this is the error I got when I tried to access my server with ssh.
$ ssh user@192.168.0.xxx
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ED25519 key sent by the remote host is
SHA256:ddoR5zHpVPkd0MP8uguLRdXa21PdsxLGHroeGEZAftM.
Please contact your system administrator.
Add correct host key in /home/yosuke/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /home/yosuke/.ssh/known_hosts:48
remove with:
ssh-keygen -f "/home/yosuke/.ssh/known_hosts" -R "192.168.0.106"
Host key for 192.168.0.106 has changed and you have requested strict checking.
Host key verification failed.
The solution:
And this is how I solved it. Just replace 192.168.0.xxx with your own server’s address and execute this command in your CLIENT machine, not the server.
$ ssh-keygen -R 192.168.0.xxx
Host 192.168.0.xxx found: line 48
/path/to/.ssh/known_hosts updated.
And when I tried to access it with ssh again, it worked!!
$ ssh user@192.168.0.xxx
The authenticity of host '192.168.0.xxx (192.168.0.xxx)' can't be established.
ED25519 key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:29: [hashed name]
~/.ssh/known_hosts:31: [hashed name]
~/.ssh/known_hosts:35: [hashed name]
~/.ssh/known_hosts:37: [hashed name]
~/.ssh/known_hosts:38: [hashed name]
~/.ssh/known_hosts:42: [hashed name]
~/.ssh/known_hosts:43: [hashed name]
~/.ssh/known_hosts:44: [hashed name]
(2 additional names omitted)
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.0.106' (ED25519) to the list of known hosts.
user@192.168.0.xxx's password:
Thanks for reading!!