So I have a very simple rsync command that is set within a script.
rsync -avzh /mnt/data/i user@server:/mnt/data/
When I run the script manually there are no issues. When I run the script from crontab I get the following in my output:
WARNING: ECDSA key found for host server
in /home/user/.ssh/known_hosts:9
ECDSA key fingerprint
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]
So rsync finds the ssh key but for some reason cannot use it. Now I found some questions that were for the same error and were solved. One involved running the script in cron and manually as different users. I have verified via a whoami within the script that the cron job runs as the same user that I am using to manually run the script. Another question is solved by defining where the rsync command is in the file system. This one also has been checked by running a which within the script.
Now through all of this I have noticed that rsync is using ssh to do its job. So I checked the locations of ssh within the script. Two separate locations, one in /usr/share/centrifydc/bin, when run manually, and the other in /usr/bin, when run by cron.
So this led me to checking out the .bashrc and .bash_profile to find out if that path or possibly alias is set there. It is not.
This leads me to the actual question, how can I set the /usr/share/centrifydc/bin/ssh binary as the default for the cron jobs? And if I do will it fix the issue?