Send files via rsync defining user and group

1

I have the following script that sends files from a local folder to a remote server:

rsync -Crav --exclude 'storage' --exclude 'error_log' --exclude 'database.php' --progress --partial --rsh='ssh -p1150' /home/user/Projects/project-local/* [email protected]:/home/user/www/project-remote


I would like to know if there is a possibility to define that the files and folders will get there with the owner and group of files 'user10' (example). If yes, I also wanted to know how to say that the folder and files inside 'vendor' will have another group and owner different from the others already defined. Thanks in advance.

    
asked by anonymous 14.07.2014 / 03:30

1 answer

1

Do what you're looking for if you run rsync from the target machine as root ( sudo ), preserving owner and group from the source:

sudo rsync -Crav user@origem:/dir/de/origem /dir/de/destino

To resolve the second question, change the ownership of the files inside the vendor before the rsync rotate.

    
16.09.2014 / 21:35