Yalamber
Yalamber

Reputation: 7580

Rsync files in local directories and chmod issues

When I do rsync this is my command:

rsync -a source dest

I am using dest as my web root /var/www/ so some folder which are set to chmod 777 were no longer with 777 permission. does rsync change folder permission as well?

What is best way to sync two local folders in same server.? Will rsync delete any changes done in destination and use the source files?

Upvotes: 1

Views: 3960

Answers (1)

twalberg
twalberg

Reputation: 62369

The manual page for rsync says this:

-a, --archive    archive mode; equals -rlptgoD (no -H,-A,-X)

Among those options is -p, about which it says:

-p, --perms      preserve permissions

So, yes, rsync is making the permissions on dest match those on source in this case. If that is not desired, then read the manual page and decide what options are more appropriate to your need than rsync -a, and use those instead. In the simplest case, add the --no-perms flag after -a to disable the permission preservation.

Upvotes: 1

Related Questions