Host key verification failed, lost connection and RSA host key for has changed and you have requested strict checking.


When I try to use SCP command to transfer any file,  I saw”  Host key verification failed, lost connection and RSA host key for has changed and you have requested strict checking. ” error.


Details of error are as follows.

[oracle@msddbadm01 ]$ scp FULL_msd_Jun_26_20_12_00_02.dmp
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
Please contact your system administrator.
Add correct host key in /home/oracle/.ssh/known_hosts to get rid of this message.
Offending key in /home/oracle/.ssh/known_hosts:11
RSA host key for has changed and you have requested strict checking.
Host key verification failed.
lost connection




This error is related with the Host key verification. Because this host had the different host key verification before we try to use SCP command from msddbadm01 to This servers’ host key is changed.


So we need to update this host verification or remove the old key manually.

To solve this error, you can update this host verification as follows.

[oracle@msddbadm01 ~]# ssh-keygen -R
/home/oracle/.ssh/known_hosts updated.
Original contents retained as /home/oracle/.ssh/known_hosts.old
[oracle@msddbadm01 ~]#
[oracle@msddbadm01 ~]#


Or you can remove the old key on msddbadm01 manually, then generate the new SSH RSA Host Key on Target ( R ) and add this host key to Source ( msddbadm01  ) as follows.

Firstly Remove the old key on source.

[oracle@msddbadm01 ~]$ cat /home/oracle/.ssh/known_hosts | grep ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0p/fQEw3C7Y7djLXT6l+QbEJ8o30S+9nK9n9iLO0AheE11jNfg/sILc+JO9grO5GBdmWDkBKRsa177dJq0CxuMSQsjvr2SePLbDJ3fUoKWmyJ9pgbpgeBIZOHM9h96zpuqYU05OY13Zj7Wf783TpcGaMKKjLWMvchnC0eXBrdP5UCqpPj0oEJW/W1P1ZHmD+G5Q7s0NdVcPL9ymx+LqLYabriHbLg7WKYdXf7hZV5IeyKsDp/Rn1eWXzEa50280vlxUzMOsPPE58gW34YZYRjKrqxLCWVf7nUarEygBXYkuJ0zejgdd4FjJ8sOsCV553GxejQOtiJLBSBf7IFdol0w==
[oracle@msddbadm01 ~]$


And Generate the new SSH RSA Host Key on Target.

[oracle@ ~]# ssh-keyscan -t rsa
# SSH-2.0-OpenSSH_7.4 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3zHBALlg9JRWhRzCLDOuKKQ/Etzsdrbrvw5FIk+LhIRQcZErGY7SsyOxuCDCpo9E7/sJQ67LsG0qxliePQMbtTw3tccmFonHKv30CHjxVZfrBJHOhdEsdFusUhjVWOG9hxMpx8FMVoUlWbh50zSjv7SM3N6/+QRdEqPytsBHiayi8fGs36oxe4BhCGP66Q+rAj/coeuSCb8LuPXWsZwIB0kJboigdNzDZEsdaaNzHIkrnk/4HVxE6ViIcGWtVqSYmsVoVNY8V6Y2aU0TnV9XNeN4YyK7c2BvYCqqnlhmPatC5EsDP3hWIMDpfAjtLP4pXCKass94tePm38I/u5vs/
[root@ ~]#


Then add or copy paste to this host key into Source /home/oracle/.ssh/known_hosts

The new /home/oracle/.ssh/known_hosts file will be as follows after changing.

[oracle@msddbadm01 ]$ cat /home/oracle/.ssh/known_hosts | grep ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3zHBALlg9JRWhRzCLDOuKKQ/Etzsdrbrvw5FIk+LhIRQcZErGY7SsyOxuCDCpo9E7/sJQ67LsG0qxliePQMbtTw3tccmFonHKv30CHjxVZfrBJHOhdEsdFusUhjVWOG9hxMpx8FMVoUlWbh50zSjv7SM3N6/+QRdEqPytsBHiayi8fGs36oxe4BhCGP66Q+rAj/coeuSCb8LuPXWsZwIB0kJboigdNzDZEsdaaNzHIkrnk/4HVxE6ViIcGWtVqSYmsVoVNY8V6Y2aU0TnV9XNeN4YyK7c2BvYCqqnlhmPatC5EsDP3hWIMDpfAjtLP4pXCKass94tePm38I/u5vs/
[oracle@msddbadm01 ]$


Once you add or copy paste to this host key into Source /home/oracle/.ssh/known_hosts, the issue will be solved.

Try to use SCP again, it will work fine as follows.

[oracle@msddbadm01 ]$ scp -r Backup29.06.2020/
The authenticity of host ' (' can't be established.
RSA key fingerprint is 75:45:7e:27:1b:58:0d:3b:67:6d:63:02:cf:75:9e:43.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
oracle@'s password:
ARCHIVELOG_msd_sgv40p1b_126864_20200630.bkp 12% 334MB 110.0MB/s 00:20 ETA^CKilled by signal 2.
[oracle@msddbadm01 ]$




Do you want to learn Linux System Administration for Beginners, then read the following articles.

 64 views last month,  2 views today

Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için a mail atabilirsiniz.

Leave a Reply