rsync
rsync copied to clipboard
rsync --chmod doesn't fully support chmod(1) mode syntax
According to the rsync 3.3.0 manpage, rsync --chmod should follow the normal parsing rules specified in the chmod(1) manpage. This is not quite true as the following doesn't work:
$ rsync -av --chmod=g=o,o= testfile1 testfile2
rsync: Invalid argument passed to --chmod (g=o)
rsync error: syntax or usage error (code 1) at main.c(1782) [client=3.3.0]
The intention here is to copy the permissions from others to group (g=o), then clear others' permissions (o=).
chmod(1) supports this (POSIX calls it permcopy).
I was having the same issue but was able to do --chmod=u=rw,--chmod=g=r,--chmod=o=r as a workaround.
I wonder if using multiple --chmod flags would solve your use case too.