rsync is overwriting read-only files. How do I prevent this?
I'm using rsync -avlz to sync files between my development server and my production server. On my production server I have some config files with options specific to that server (e.g. passwords, port numbers, etc.) and I don't want those files overwritten when I do the rsync.
However, even though those files have 444 permissions, they are still being overwritten. Can anyone explain to me why this is happening or point me in the direction of how to prevent it? It seems to me that setting the files to read-only would prevent rsync from updating them.
NOTE: I'd prefer to not have to specifically exclude files if I don't have to. I'd love to have the server know not to allow overwriting of read-only files.
rsync does not care about "read-only", especially since you've told it to sync permissions as well. Keep local settings in a separate file and include them from the main configuration.