加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

如何告诉rsync不检查权限

发布时间:2020-12-14 02:30:48 所属栏目:Linux 来源:网络整理
导读:我有两个目录,每个目录都有相同的 PHP应用程序.我想从一个源目录执行rsync -rvz到另一个目标,因此rsync将仅复制更改的文件.问题是源目录中的文件有错误的755权限.目的地的权限很好. 如何告诉rsync忽略权限检查并仅按大小检查? 谢谢. 解决方法 只要您不提供-
我有两个目录,每个目录都有相同的 PHP应用程序.我想从一个源目录执行rsync -rvz到另一个目标,因此rsync将仅复制更改的文件.问题是源目录中的文件有错误的755权限.目的地的权限很好.

如何告诉rsync忽略权限检查并仅按大小检查?
谢谢.

解决方法

只要您不提供-p标志,就不应该更改权限.如果你仍然没有获得你期望的权限,请确保关闭perms并使用–chmod = ugo = rwX

以供参考:
http://linux.die.net/man/1/rsync

-r,--recursive             recurse into directories
 -v,--verbose               increase verbosity
 -z,--compress              compress file data during the transfer
 -n,--dry-run               perform a trial run with no changes made

 -p,--perms                 preserve permissions
 -E,--executability         preserve executability
     --chmod=CHMOD           affect file and/or directory permissions

-p,–perms This option causes the receiving rsync to set the destination permissions to be the same as the source permissions. (See
also the –chmod option for a way to modify what rsync considers to be
the source permissions.)

该手册继续说:

In summary: to give destination files (both old and new) the source
permissions,use –perms. To give new files the destination-default
permissions (while leaving existing files unchanged),make sure that
the –perms option is off and use –chmod=ugo=rwX (which ensures that
all non-masked bits get enabled).

附注:如果可能的话,您的开发人员可能更有意义将其更改推回到仓库中,并让所有服务器使用代码仓库,而不是使用rsync将文件从一台服务器发送到另一台服务器.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读