rsync同步文件报错如下:
[root@srv ~]# rsync -zrtopg --delete --password-file=/etc/rsyncd.secrets admin@xxx.xxx.xxx.xxx::backup /mnt/ivrSound/
rsync: opendir "/." (in backup) failed: Permission denied (13)
IO error encountered -- skipping file deletion
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1651) [generator=3.1.2]
You have mail in /var/spool/mail/root
原因显而易见,这是一个权限问题,但其实是Selinux拒掉的,由于这里说明有限,log也看不出来多大异常,故而浪费掉了我不少时间;
问题排查:
[root@srv ~]# getenforce
Enforcing
可以看到确实是selinux的问题,解决方案:
[root@srv ~]# setenforce 0
[root@srv ~]# getenforce
Permissive
当然,这个报错也可以能是用户权限不够,解决办法可以参考:rsync:错误 some files/attrs were not transferred (see previous errors) (code 23) at main.c(1518)_蝶开三月的博客-优快云博客
本文记录了一次使用rsync同步文件时遇到的权限错误,错误表现为Permission denied。通过`getenforce`命令确认问题由Selinux的Enforcing模式引起。解决方案是临时关闭Selinux的强制执行模式,使用`setenforce 0`将其切换为Permissive模式。此外,也提到了如果权限问题由用户权限不足导致,可以参考相关资料进行解决。
2921

被折叠的 条评论
为什么被折叠?



