rsync permissioning?
I have run the command
sudo rsync --chmod=a+rwx testfile testfile2
This creates a file testfile2
but the permissions on it are 755 (-rwxr-xr-x)
Can someone explain how to make it so the permissions are 777 (-rwxrwxrwx)
?
Use
sudo rsync --perms --chmod=777 testfile testfile2
or
sudo rsync --perms --chmod=a+rwx testfile testfile2
Using --chmod=777 with rsync may fail:
sudo rsync --perms --chmod=777 ./testfile ./testfile2
rsync: Invalid argument passed to --chmod (777)
rsync error: syntax or usage error (code 1) at main.c(1453) [client=3.0.9]
However, these are successful:
sudo rsync --perms --chmod=u+rwx ./testfile ./testfile2
sudo rsync --perms --chmod=g+rwx ./testfile ./testfile2
sudo rsync --perms --chmod=o+rwx ./testfile ./testfile2
i.e. add (+) permissions for user (u), group (g) or other (o) respectively.
Also (a)=all is successful:
sudo rsync --perms --chmod=a+rwx ./testfile ./testfile2
or alternatively:
sudo rsync --perms --chmod=ugo+rwx ./testfile ./testfile2
That --perms can replaced by -p with same results.
Revoking (-) permissions works the same way and even comma separated combinations of adding and revoking:
sudo rsync --perms --chmod=u-rwx,o+rwx ./testfile ./testfile2