Selinux could sometime mess up with your setup. Let’s say you configured your rsync daemon but still, you get the error related to permissions when executing the rsync to copy files!
rsync: opendir "/." (in backup2) failed: Permission denied (13)
Apparently, the rsync client connects to the server and it finds there is a section name “backup2”, but still no permission despite you explicitly set in the section uid and ig to be root (uid=0 and gid=0 in the section)!
The most common reason is
selinux denies rsync process to open the directory exported by the path in your rsync configuration file.
By default, Selinux will deny access to any of the files and directories in your system! In most cases here what can you help:
setsebool -P rsync_export_all_ro=1
rsync_export_all_ro will export any files and directories read-only and requests like above will not be denied.
The capital letter “-P” is to set it permanently for the system over reboots.
Keep on reading!