0

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.

Thank you

1 Answer 1

0

Your admin user doesn't have permission to list the contents of the /home/backup directory.

Relax the permissions. For example, if your admin user is a member of the group admin you could consider this

chgrp admin /home/backup
chmod g=rx /home/backup
2
  • would this add the user admin to the group backup to give access to list the backup folder?
    – Sam Arcos
    Apr 8, 2020 at 19:39
  • No. man chgrp and man chmod will show you that the first command changes the group of the /home/backup directory, and the second command relaxes the permissions for the group Apr 8, 2020 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .