如何告诉rsync不检查权限

前端之家收集整理的这篇文章主要介绍了如何告诉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将文件从一台服务器发送到另一台服务器.

猜你在找的Linux相关文章