服务器之家:专注于服务器技术及软件下载分享
分类导航

云服务器|WEB服务器|FTP服务器|邮件服务器|虚拟主机|服务器安全|DNS服务器|服务器知识|Nginx|IIS|Tomcat|

服务器之家 - 服务器技术 - 服务器知识 - rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

2020-08-21 16:07服务器技术网 服务器知识

今天在同步数据的时候提示rsync: failed to set times on “xxxx”: Operation not permitted,一般来说要不是服务器时间不对或者权限没有设置好

今天在同步数据的时候提示rsync: failed to set times on “xxxx”: Operation not permitted,一般来说要不是服务器时间不对或者权限没有设置好,下面服务器之家小编就为大家整理了一些资料

第一种方法:

出现rsync: failed to set times on “xxxx”: Operation not permitted的原因大致是对文件夹(或文件)xxxx没有操作权限。如果执行同步的用户是root,是不会有这样的问题,但是rsync也可以不使用root用户来进行同步,不使用root用户的情况下,即使使用了-o,-g,同步到目的文件夹的文件用户和组都变成了同步使用的用户,但是用-p后文件权限可以保留。当目的文件夹(或文件)xxxx事后做过修改使owner不是rsync使用的用户,即使xxxx的权限是777,也会出现上述错误。

 

第二种方法:

当我使用rsync同步的时候,从我本地的机器到远程服务器的机器上,同步出现错误,提示
rsync: failed to set times on “directory” Operation not permitted (1)
其中directory是远程目标服务器上的一个目录。

这个问题就是,因为 /etc/rsync.conf 文件内,你指定的uid 、 gid  的问题, 这样,你同步文件要写的目录 ,他的属主和属组 都要是/etc/rsync.conf 文件内指定的uid 、 gid  ,
这样就不会 rsync: failed to set times on  之类的错误了 !

(1)修改前,rsync 推送文件到目标服务器出错  :

rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

(2)去目标服务器查看 /etc/rsync.conf 文件,看uid和gid分别是什么 :

rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

(3)然后根据配置文件,把目标服务器的目标目录,chown 目录的属主和属组

rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

以上设置后,就OK 了 ,同步正常 :

rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted

方法三

rsync: failed to set times on "/." (in module): Operation not permitted (1)

这个是rsyncd.conf 里面 read only = no 注销也不行,因为默认值是yes

方法四: windows下面一般都是因为服务器端目录权限设置不正确引起的。一般情况下SvcCWRSYNC用户需要加入同步目录中并给所有权限或者直接将SvcCWRSYNC设为管理员权限也行(最好禁止SvcCWRSYNC这个用户远程登录)

服务器之家小编注:如果更改的权限什么的,需要重启rsync服务。经过测试完美解决问题。

延伸 · 阅读

精彩推荐