title: Rsync with sshpass on Linux using systemd: 'Host key verification failed.'
body: <p>I am trying to set up rsync with sshpass on a RaspberryPi to connect to a Synology drive in order to synchronize data. </p>
  
  <p>The listed command:</p>
  
  <pre><code>sshpass -p 'password' rsync -avz -e 'ssh -p 22' \home\pi host@IP::home/example
  </code></pre>
  
  <p>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':</p>
  
  <pre><code>import subprocess
  subprocess.run([ sshpass -p 'password' rsync -avz -e 'ssh -p 22' \home\pi host@IP::home/example])
  </code></pre>
  
  <p>Whenever I want to autostart the python script using systemctl as a service, I get the following error:</p>
  
  <blockquote>
    <p>Host key verification failed.
    rsync error: received SIGINT, SIGTERM or SIGHUP (code 20) at rsync.c(644) [sender=3.1.3]</p>
  </blockquote>
  
  <p>I am wondering, what ist the difference between the command prompt and systemd in this case?</p>
  
  <p>Thank you so much for your help in advance! I really appreciate every Tip!!!
  Kilian</p>