Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu-ssh - - WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED [closed]

Tags:

ssh

openssh

I'm unable to ssh and rysnc to a remote system. It keeps giving this error message:

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 RSA key sent by the remote host is a3:8f:7c:07:c9:12:d8:aa:cd:c2:ba:b3:27:68:bc:c2. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending RSA key in /root/.ssh/known_hosts:8 RSA host key for xxx.xxx.xxx.xxx has changed and you have requested strict checking. Host key verification failed. rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(601) [sender=3.0.8] 

I've removed authorized_keys file from /home/user/.ssh.

like image 967
Thiyagarajan Varadharaj Avatar asked Dec 28 '11 09:12

Thiyagarajan Varadharaj


People also ask

How do I get rid of warning remote host identification has changed?

You should delete the key causing the “Warning: Remote host identification has changed” error, then save your changes. You might also want to delete the entire known_hosts file, especially if you only use SSH for one or two sites. To do this, you can run rm . ssh/known_hosts in a Terminal window.

How do I disable strict host key in SSH?

Using Config File You need to create a ~/. ssh/config file and disable strict host key checking by adding the content. This will disable host checking for all hosts you connect to. Rather than disabling host check for all Host “*”, it would be safer to specify a particular host.

Can I delete the known_hosts file?

Windows with PuTTY Search for regedit.exe and open it. Navigate to HKEY_CURRENT_USER/SOFTWARE/SimonTatham/PuTTy/SshHostKeys. Right click the offending key and click delete.

What is the known_hosts file?

The known_hosts file is for verifying the identity of other systems. ssh(1) can automatically add keys to the user's file, but they can be added manually as well. The file contains a list of public keys for all the hosts which the user has connected to.


2 Answers

The message says "/root/.ssh/known_hosts" not authorized_keys. Remove that file (or at least the corresponding key) from it and you can go again! But be aware that: There must be a reason why the key changed. Was the system reinstalled? Make sure you check that or the whole idea of ssh is void.

BTW.: Is there a reason you ssh as root?

like image 20
Nikodemus RIP Avatar answered Sep 30 '22 01:09

Nikodemus RIP


use the following command which removes the old keys from .ssh/known_hosts file

ssh-keygen -R <host> 
like image 187
Talespin_Kit Avatar answered Sep 30 '22 03:09

Talespin_Kit