微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何告诉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将文件从一台服务器发送到另一台服务器.

原文地址:https://www.jb51.cc/linux/395639.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐