0

I run into a "Disk quota exceeded (122)" error if I use rsync -p <args> to copy files around.

rsync -rlptD --chown username:org1 -- local/ /project/org1/

I would like to preserve source read and execute bits on files and directories, but force the destination to have group setuid g+s on directories.

The reason for wanting g+s on directories is so that new files inherit the project's group ownership. In my environment, if files within project folders (e.g. /project/foo/) are owned by my personal group (groupname == username), I run into the quota error.

I've given the --chown username:org1 argument to rsync as an attempt to force usage of group org1 throughout, but it's insufficient. I think there's a race condition where rsync applies the desired user:group ownership after the temporarily files are renamed to their final location.

If I remove the -p from the rsync flags, then I can transfer without errors, but I lose the permission bits from the source. Without -p, any temporary file created by rsync in the destination folder correctly inherits the project group from the root folder, and subfolders inherit the group setuid.

Is there a way to give rsync a mask of permissions to keep? I need bitmask 777 from the source, but g+s set (unconditionally) for remote directories.

  • 1. What file systems are you using (where you have the source and the target for the rsync copying process? 2. What operating system and 3. version of rsync are you using? – sudodus Jan 10 at 9:24
0

I believe the --chmod RULE[,RULE]* option may help.

From man rsync(1):

--chmod

This option tells rsync to apply one or more comma-separated "chmod" modes to the permission of the files in the transfer. 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.

Try --chmod Dg+s to force directories on the remote to have setuid on the directories.

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.