When I launch this script:#!/bin/bash -vsshpass -p '<pypasswd>' scp blah.img root@myip:/home/user/blah.imgexit 0with./script.shor nohup ./script.sh &it works.But when I do nohup sudo ./script.sh &it fails (nothing is uploaded, and I once got a authentification error, that I cannot reproduce anymore). Why?Note: I usually use nohup sudo ./script.sh & for some other scripts and it usually works perfectly.Note 2: I really need sudo because there are other things in my script that need sudo.
Script works without sudo, fails with sudo
ssh;sudo;scp;sftp
I suspect there's no myip recorded in /root/.ssh/known_hosts.  Please try once sudo ssh root@myip interactively before running that script.Alternatively, you can disable host key checking:#!/bin/bash -vsshpass -p '<pypasswd>' scp -o StrictHostKeyChecking=no blah.img root@myip:/home/user/blah.imgexit 0