Using the following rsync command, the RWX permissions are being correctly set for both files and directories but the sticky bit options are not.

rsync -rtvz --partial-dir=.rsync-partial --chmod=Da+t,Dg+s,D770,F0740 --progress --stats -e 'ssh -p 19419' "/home/me/test_dir" me@REMOTE_HOST:~

I understand that the options should act as below:


  • all dirs should have sticky bit set (only the root user, the owner of the directory, and the owner of a file can remove files within said directory.)


  • all dirs should have setGID (all files created within said directory inherit the group ownership of that directory)

but sticky bits and setGID bits are not set on the REMOTE_HOST dirs with the above command.

If I ssh to the REMOTE_HOST and run something like chmod -R a+t test_dir then the sticky bits will be set as expected.

Where am I going wrong?

Edit: I also separately tried just "--chmod=Da+t,Dg+s", "--chmod=Da+t" "--chmod=Dg+s" "--chmod=a+t" and no sticky bits are set with any of these options.

(Ubuntu 16.04, rsync 3.1.1 - I took the chmod options straight from the man page)


You need to use the -p flag for rysnc.

  • terse but helpful
    – ezekiel
    Nov 11 '20 at 9:56

The modes are applied in the order given. This means the later D770 option overrides any earlier modes to set the directory to exactly 770. Change the order to:

  • hi, thanks for reply! Unfortunately this hasn't made any difference. I should have noted that I tried ordering the options differently. I just tried the specific ordering you suggest here. I also separetely tried just "--chmod=Da+t,Dg+s", "--chmod=Da+t" "--chmod=Dg+s" and no sticky bits are set.
    – ezekiel
    Nov 11 '20 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.