Reputation: 83
I am trying to set up rsync with sshpass on a RaspberryPi to connect to a Synology drive in order to synchronize data.
The listed command:
sshpass -p 'password' rsync -avz -e 'ssh -p 22' \home\pi host@IP::home/example
works out fine, if I run it manually at the command prompt. As well it works out, when I implement it into a python script using the package 'subprocess':
import subprocess
subprocess.run([ sshpass -p 'password' rsync -avz -e 'ssh -p 22' \home\pi host@IP::home/example])
Whenever I want to autostart the python script using systemctl as a service, I get the following error:
Host key verification failed. rsync error: received SIGINT, SIGTERM or SIGHUP (code 20) at rsync.c(644) [sender=3.1.3]
I am wondering, what ist the difference between the command prompt and systemd in this case?
Thank you so much for your help in advance! I really appreciate every Tip!!! Kilian
Upvotes: 4
Views: 2780
Reputation: 56
The rude way is to add -o "StrictHostKeyChecking=no"
to your SSH command:
sshpass -p 'password' rsync -avz -e 'ssh -o "StrictHostKeyChecking=no" -p 22' \home\pi host@IP::home/example
Upvotes: 4