--chmod overrides the sending side permissions, but if you don't specify -p or --perms as well then the destination defaults are used regardless (i.e. --chmod is ignored).
This option tells rsync to apply one or more comma-separated "chmod" strings to the permission of the files in the transfer. The resulting value is treated as though it was the permissions that the sending side supplied for the file, which means that this option can seem to have no effect on existing files if --perms is not enabled.
I think you need to add --perms (aka -p). Quoting from the manpage:
When this option is off, permissions are set as follows:
...
New files get their "normal" permission bits set to the source file's permissions masked with the receiving directory's default permissions (either the receiving process's umask, or the permissions specified via the destination directory's default ACL), and their special permission bits disabled except in the case where a new directory inherits a setgid bit from its parent directory.
I suspect your destination system has a typical umask like 022 which is preventing the group write bit from being set by rsync. Unfortunately --chmod doesn't mention how the umask does or does not apply.
发布评论
评论(3)
--chmod
会覆盖发送端权限,但如果您未指定-p
或--perms
无论如何,都会使用目标默认值(即忽略--chmod
)。来自 man 1 rsync:
--chmod
overrides the sending side permissions, but if you don't specify-p
or--perms
as well then the destination defaults are used regardless (i.e.--chmod
is ignored).From man 1 rsync:
您必须将
--chmod
与-p
选项一起使用,如下所示:这是一个完整的测试:
在文件夹中创建一些文件
默认权限是:
u=rw, g=r, o=r
尝试不带参数的 rsync
目标权限与源文件相同
指定 rsync 选项
--chmod=o-rwx -p
现在你的烫发就可以了。
You have to use
--chmod
with-p
options, like this:And here is a full test:
Create some file in a folder
The default perms are:
u=rw, g=r, o=r
Try an rsync without params
The destination perms are the same than the source files
Specify the rsync options
--chmod=o-rwx -p
And now your perms are ok.
我认为您需要添加
--perms
(又名-p
)。引用手册页:我怀疑您的目标系统有一个典型的 umask,如 022,它会阻止 rsync 设置组写入位。不幸的是
--chmod
没有提到 umask 如何应用或不应用。I think you need to add
--perms
(aka-p
). Quoting from the manpage:I suspect your destination system has a typical umask like 022 which is preventing the group write bit from being set by rsync. Unfortunately
--chmod
doesn't mention how the umask does or does not apply.