I used the rsync to copy files from a remote location. After the copy, on the destination server, the files has different ownership. How can I use the rsync to update the ownership of the files? (preserve the origin) thx, István They have different UID and GID (different user).

  • Are the UIDs and GIDs the same on both machines? – waltinator Feb 22 '18 at 15:02
  • check the -o and -g flags:

    -o, --owner                 preserve owner (super-user only)
    -g, --group                 preserve group
        --devices               preserve device files (super-user only)
        --specials              preserve special files
  • You can also use -a

     -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
         --no-OPTION             turn off an implied OPTION (e.g. --no-D)

    since that is for "archive" and include the -o and -g. Mind the "super-user only".

For more info type man rsync on command line or click the link.

  • Will it copy the files again? – István Radics Feb 22 '18 at 14: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.