Host key verification failed. when Using scp inside ssh EOL


This Content is from Stack Overflow. Question asked by Kalyan Raparthi

I am trying to run multiple ssh command using the bellow shell script

ssh -T root@  <<'EOL'

     CHOOSE_DB=$(ls -t /var/mapbackup/mapdb* | head -1)
     scp -r root@$CHOOSE_DB /app/map/
     echo $CHOOSE_DB

First 2 command work well but scp fails with Host key verification failed.

Login got success for ssh but i feel scp not able to fetch password from EOL Here is the screen short of the error
enter image description here

Can Someone help correcting my script


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?