How can I use rsync to ignore file permissions?

0
4
Asked By WanderLust123 On

Hey everyone! I'm trying to figure out how to use rsync for a reverse sync, moving files from directory **b/** back to **a/**. When I used the command `rsync -anchuv b/ a/`, I noticed that the permissions between the files in **a/** and **b/** aren't matching up. I found out that using the **-p** flag is meant to preserve permissions, but how do I set it up to ignore permissions altogether? Should I consider using `-apn`? Just for context, I'm using the flags **chuv**, which are outdated as **-r** has been replaced with **-a** now. Any help would be appreciated! Thanks!

2 Answers

Answered By TechGuru99 On

To ignore permissions when using rsync, just avoid using the **-p** or **-a** option since they preserve permissions by default. If you want rsync to use default umask permissions on the copied files instead of preserving them, simply leave those options out. This way, it’ll ignore file permissions altogether during the sync process.

Answered By BackupBuddy42 On

You really have to consider that every file has some permissions and ownership that needs to be respected, especially for backups. For many people, it's best to ensure that the backup is an exact copy of the original, including ownership and permissions. That's why I'd recommend sticking with the **-a** option for preserving all attributes. But if you're looking for a simpler solution and just need the files without caring about permissions, just don't include those flags!

CuriousCat88 -

But what if the files aren’t supposed to be writable? Wouldn’t ignoring permissions just cause issues later?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.