Send files via rsync setting user and group

Asked

Viewed 271 times

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 wanted to know if there is a possibility to define which 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 within 'vendor' will have another group and owner different from the others already defined.
Thanks in advance.

1 answer

1

Do what you want if you run the rsync from the target machine as root (sudo), preserving Owner and group of origin:

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

To solve the problem of the second question, change the file Ownership within vendor before the rsync rotate.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.