I am trying to setup rsync to backup to a remote ssh server but I get this error:
rsync: opendir "/home/backup/." failed: Permission denied (13)
this is the rsync command:
sudo -u admin rsync -avzh /home/backup/ [email protected]:/home/sam/prodweb
I am trying to run the command as the admin user, since he has permissions to the tar files inside the backup folder. This is the setup where the folders live:
sudo ls -l /home/ total 4 drwx--x--x. 9 admin admin 172 Mar 19 12:49 admin drwx--x--x. 3 backup backup 4096 Apr 8 03:10 backup drwx------. 6 sam sam 228 Apr 3 15:08 sam sudo ls -l /home/backup/ total 12902820 -rw-r----- 1 admin admin 214722560 Apr 6 03:10 admin.2020-04-06_03-10-12.tar -rw-r----- 1 admin admin 214702080 Apr 7 03:10 admin.2020-04-07_03-10-13.tar -rw-r----- 1 admin admin 214732800 Apr 8 03:10 admin.2020-04-08_03-10-13.tar
I have tried running the command as backup user, but I get the same error, but when reading the individual files (since they are own by admin) This is a vestaCP setup, in case anyone has figured a different solution. I have tried using the remote sftp setup, but i have had no luck, plus with Rsync I can use ssh keys.
I think the issue is because the folder is owned by backup user and files are owned by admin user. I am still a beginner to ubuntu and centos. I am trying to leave the permissions untouched, since I would run this command from Cron every morning right after the VestaCP Backup.