Wednesday, October 7, 2015

'Host key verification failed' Error when scp from one host to another in linux


Problem

When Try to copy file from one host to another below error occur
[root@backup u01]# scp -r RPM_oel6/ 192.168.22.4:/u01
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
ea:d6:b9:ac:45:e5:4a:46:ff:71:0b:84:a6:24:de:b2.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:2
RSA host key for 192.168.22.4 has changed and you have requested strict checking.
Host key verification failed.
lost connection

Solution

Please execute below command and copy again to overcome the issue
sed -i '2d' /root/.ssh/known_hosts 
Where '2d' is line number. If the line number is different then use the same

No comments:

Post a Comment