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

相關文章
相關標籤/搜索