How to keep rsync from chown'ing transferred files?
Solution 1:
You are probably running rsync like this:
rsync -a dir/ remote:/dir/
The -a
option according to the documentation is equivalent to: -rlptgoD
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
You probably want to remove the -o
and -g
options:
-o, --owner preserve owner (super-user only)
-g, --group preserve group
So instead your rsync command should look something like this:
rsync -rlptD dir/ remote:/dir/
Or as @glglgl points out:
rsync -a --no-o --no-g dir/ remote:/dir/
The remaining options in use are:
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-p, --perms preserve permissions
-t, --times preserve modification times
-D same as --devices --specials
--devices preserve device files (super-user only)
--specials preserve special files
Solution 2:
Don't pass -o
or any of the other options that implies it.
Solution 3:
Don't use the -a
option, as it will include the -p
option that keeps the permissions. For this situation, the -r
should be enough.
For more infos, see man rsync
.