rsync报错: Operation not permitted (1)
[rsync报错:rsync: chgrp “.initial-setup-ks.cfg.jaXlVz” (in backup) failed: Operation not permitted (1)]问题背景:在配置好rsync服务和客户端后,客户端从服务端拉取是正常的,但从客户端推送到服务端报错。a,单独推送目录会报这个错误rsync: recv_generator: mkdir “opt”
[rsync报错:rsync: chgrp “.initial-setup-ks.cfg.jaXlVz” (in backup) failed: Operation not permitted (1)]
问题背景:在配置好rsync服务和客户端后,客户端从服务端拉取是正常的,但从客户端推送到服务端报错。
a,单独推送目录会报这个错误
rsync: recv_generator: mkdir “opt” (in backup) failed: Permission denied (13)
[root@jxl ~]# rsync -avz aa.txt rsync_backup@192.168.81.230::backup
sending incremental file list
aa.txt
rsync: chgrp ".aa.txt.rn3eFN" (in backup) failed: Operation not permitted (1)
sent 96 bytes received 125 bytes 442.00 bytes/sec
total size is 3 speedup is 0.01
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
如果从客户端向服务端推送目录和文件也报错rsync: chgrp “.backup.sh.RwFAWn” (in backup) failed: Operation not permitted (1)。但文件传过去了,目录并没有传过去
[root@nfs01:/opt]# rsync -avz /opt/ rsync_backup@192.168.81.230::backup
Password:
sending incremental file list
./
backup.sh
hejian.txt
services
rsync: chgrp ".backup.sh.RwFAWn" (in backup) failed: Operation not permitted (1)
rsync: chgrp ".hejian.txt.iLqEOb" (in backup) failed: Operation not permitted (1)
rsync: chgrp ".services.vxwJGZ" (in backup) failed: Operation not permitted (1)
sent 136,811 bytes received 340 bytes 21,100.15 bytes/sec
total size is 697,812 speedup is 5.09
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1178) [sender=3.1.2]
然后检查/backup目录的权限被修改成了550,原来设置的是755,然后把权限修改成755后再重新操作
[root@backup:/backup]# ls -ld /backup/
dr-xr-x--- 3 rsync rsync 312 Sep 1 07:54 /backup/
root@backup:/backup]# chmod 755 /backup/
[root@backup:/backup]# ls -ld /backup/
drwxr-xr-x 4 rsync rsync 324 Sep 1 08:03 /backup/
但修改完后再通过客户端同步,还是报上面的错,并且刚修改的目录权限又变成了550
从网上查询的说是selinux影响,但我检查两台服务器的selinux设置的都是disabled,防火墙也处于关闭状态
[root@backup:/backup]# getenforce
Disabled
经排查是由于-a参数导致的,因为-a是归档模式传输,并保持所有文件属性,等价于-rtopgDl(还没有具体深入研究),可以使用下面这个命令替代
[root@nfs01:/opt]# rsync -rltDvz /opt/ rsync_backup@10.0.0.41::backup
不用-a确实解决了,但是经过检查配置文件发现fake super配置参数写成了fake supper因此导致没有root权限。
因此使用-a必须具备fake supper = yes的配置参数才可以。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)