Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using rsync to sync a directory from a machine to another but I encountered the following problem: the destination directory permissions are altered.

rsync -ahv defaults/ root@hostname:~/

The problem is that in this case the permissions and ownership of the defaults forlder will be assigned to the destination folder.

I do want to keep the permissions for the files and subdirectories but not for the source directory itself.

Also, I do not want to remove any existing files from the destination (but to update them if needed), but I think that current settings are already ok regarding this.

How can I do this?

share|improve this question
up vote 4 down vote accepted

If you want to exclude the defaults directory from having its permissions altered, you would have to literally not include in the command (since you obviously want to maintain the permissions of everything you are copying). You can thus either do this:

rsync -ahv defaults/* root@hostname:~/

Or, in case you have files or directories starting with a dot inside defaults, and assuming you are using bash:

shopt -s dotglob
rsync -ahv defaults/* root@hostname:~/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.