January 15, 20251 yr Hi, I use rsync via multiple scripts on a daily basis to backup and pull data from a remote server but I alwyas find a little bit annoying setting up the permissions manually to match those in my unraid. Default shares permissions is nobody:users 777 (drwxrwxrwx) for directories and 666 for individual files (-rw-rw-rw) My current rsync command is like this: rsync -rltvzh --progress --chown=nobody:users --chmod=775 remote_ip::rsync_module /mnt/user/dir but this doesn't not produce the same output permission wise so I wonder if anyone uses rsync in a better way. Thanks
January 15, 20251 yr Community Expert ?... rsync -avz --progress --chmod=775 remote_ip::rsync_module /mnt/user/dir Explanation of Options: -a: Archive mode. Preserves symbolic links, file permissions, modification times, and more. -v: Verbose. Shows what’s being transferred. -z: Compress file data during transfer for faster syncing. --progress: Displays progress of the sync. --chmod=775: Ensures the files have 775 permissions after the transfer. Key Changes: Removed -r because -a (archive) already includes recursion. Removed --chown=nobody:users because it overrides file ownership. If maintaining permissions is crucial, let rsync transfer the original ownership unless there's a specific requirement to change it. If the default share permissions on your system are nobody:users with 777 for directories and 666 for files, and you want rsync to maintain the source permissions during the transfer, here’s the corrected command: rsync -avz --progress remote_ip::rsync_module /mnt/user/dir as Rsync will already do that... Explanation: -a (archive): Ensures permissions, ownership, timestamps, and symbolic links are preserved. -v (verbose): Shows detailed output during the transfer. -z (compression): Compresses file data during the transfer. --progress: Displays the transfer progress for each file. Important Notes: Default Behavior: The -a flag ensures that rsync carries over the original file and directory permissions from the source. Ownership (nobody:users) and default share permissions (777 for directories, 666 for files) will remain intact as long as they match the source. No Ownership Changes: Avoid using --chown unless you specifically need to set ownership differently during transfer. Preserving Permissions: If the files and directories on the source have permissions other than 777 or 666, rsync will copy them as-is. Matching Default Share Permissions: If you want to enforce 777 for directories and 666 for files explicitly during transfer, add --chmod=Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=rw rsync -avz --progress --chmod=Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=rw remote_ip::rsync_module /mnt/user/dir ?... why are you adding a 755 ?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.