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)?

3 Answers 3



sudo rsync --perms --chmod=777 testfile testfile2


sudo rsync --perms --chmod=a+rwx testfile testfile2
  • yup, from man page: The resulting value is treated as though it were 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.
    – Jeremy L
    Jul 15, 2010 at 14:49
  • @Nerdling - Exactly...
    – Pylsa
    Jul 15, 2010 at 15:02
  • I get Invalid argument passed to --chmod (777) with the first option. Seems to be explained here?
    – user84636
    May 28, 2013 at 20:29

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
  • 2
    chmod 777: nonononono! Never ever run chmod 777. It is practically never required! Not even for "testing purposes". If the file is readable, then it's readable. If it's writable by the user or group that need to write to it, then it's writable. There is absolutely zero need to give everyone write permissions, and forgetting to chmod it back to something sane is exactly how multinationals get hacked. Just don't do it. Ever. I wrote an introduction of Unix permissions. Please read it! Mar 13, 2016 at 6:10
  • o+rwx is the same effect/problems (gives "other" read/write access, which is everyone!) Mar 13, 2016 at 6:10
  • The header reads "rsync permissioning", i.e. the question is about correct syntax of rsync.
    – ajaaskel
    Mar 14, 2016 at 9:50

I would be lying if I said “i found this in the documentation”, only in an SO question, but still it works!

--perms  --chmod=D770,F660 

gets you 'executable' on directories (alias: directories are browsable) while all files are non-executable. (=just what the doctor ordered. Same thing can be achieved with the regular chmod command by using an uppercase X -x+rwX, but not with rsync...) so this is just nice to know.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .