Host key verification failed. when Using scp inside ssh EOL

Issue

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

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

#!/bin/bash
ssh -T root@10.123.234.456  <<'EOL'

     '/var/map/pg_dump.sh'
     CHOOSE_DB=$(ls -t /var/mapbackup/mapdb* | head -1)
     scp -r root@10.123.234.456:$CHOOSE_DB /app/map/
     echo $CHOOSE_DB
EOL

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

Can Someone help correcting my script


Solution

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?

Exit mobile version