I have a bash script that uses SCP to download files from a remote server. The script runs correctly when run from terminal but fails when run by cron giving this error:
Host key verification failed.
This script worked correctly when run by cron on Fedora 42. Here’s the script (note: src_server.com has been changed for posting. The actual actual script uses the correct domain name):
The source files exist and the script worked correctly previous on Fedora 42 and works correctly now when run in terminal. Any help will be greatly appreciated. TIA
This looks like an error caused by the UID that this crontab belongs to. Check to see if it is executing as the same UID that you are using to test it. The error is basically saying “I can’t find the knwon_hosts file with this target’s address/name in it” …
This error means that the host you are connecting to identification key has changed. Did the server you are connecting to also change or update it’d SSHD server?
Make sure the user the crontab is running under has properly configured known_hosts.