I have the following scenario:
- motion is creating directories and files with the user:group
motion:motionand the permissions
as a cron task, I'd like to periodically copy these files to a remote computer and then delete them. The command I'm trying to use is
sudo rsync -avz --remove-source-files /home/pi/Pictures/SecurityCamera/ username@host:/Users/username/Pictures/SecurityCamera
The files are successfully copied to the remote machine, however without the
sudo, the local files aren't deleted. With the
sudo, I'm required to enter my password for the remote machine, even though I've set up public key authentication.
I've tried changing a few settings in the remote sshd_config to no avail
PermitRootLogin without-password StrictModes no
I've also tried adding the both the
root user to the motion group, but looking more closely at the permissions, groups don't have write access to the files I'm moving.
How can I use
sudo rsync to delete local files created by another user without entering a password for the remote machine?