rsync报错:rsync: chgrp ".hejian.txt.D1juHb" (in backup) failed: Operation not permitted (1)

问题背景:在配置好rsync服务和客户端后,客户端从服务端拉取是正常的,但从客户端推送到服务端报错。
a,单独推送目录会报这个错误
rsync: recv_generator: mkdir "opt" (in backup) failed: Permission denied (13)linux

[root@nfs01:/opt]# rsync -avz /opt rsync_backup@10.0.0.41::backup
Password:
sending incremental file list
rsync: recv_generator: mkdir "opt" (in backup) failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
opt/

sent 472 bytes  received 172 bytes  257.60 bytes/sec
total size is 697,812  speedup is 1,083.56
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@10.0.0.41::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/

但修改完后再经过客户端同步,仍是报上面的错,而且刚修改的目录权限又变成了550this

从网上查询的说是selinux影响,但我检查两台服务器的selinux设置的都是disabled,防火墙也处于关闭状态code

[root@backup:/backup]# getenforce
Disabled

经排查是因为-a参数致使的,由于-a是归档模式传输,并保持全部文件属性,等价于-rtopgDl(尚未具体深刻研究),可使用下面这个命令替代ip

[root@nfs01:/opt]# rsync -rltDvz /opt/ rsync_backup@10.0.0.41::backup

若是还想使用-avz这个参数组合的话,能够在rsyncd.conf配置文件中添加一个参数fake super = yes也能解决问题
,一样的命令和配置文件rsync在CentOS6系统以前是不须要的,CentOS7系统须要增长这个参数才不会报错rem

相关文章
相关标签/搜索