Title says it all really.
I see that you can preserve owner:group but is it possible to change the owner:group on all files on the remote after they've been synced?
Or can you somehow pipe an extra command?
rsync -vzrP --delete ~/Sites/website-name/ [email protected]:/home/website-name/public_html/ | chown website-name:websites-group *
Sorry, my rsync/bash knowledge is pretty limited.
'rsync -a' option preserves the permissions, ownership, timestamp of files and folders that are to be transferred using rsync. This will synchronize the two folders or files and will also maintain the same timestamp as that of the source.
Rsync is a command-line tool for copying files and directories between local and remote systems that should be in every Linux sysadmin's toolbox.
Method 1: Using –progress option to see the rsync progress:Use the “–progress” in the rsync command and “-av” to get a summary at the end of file transfer, consisting of transfer rate, sent/receive bytes, speed of transfer, and total file size.
Yes, rsync
provides the --usermap
and --groupmap
options to allow you to customise how these are mapped at the remote end.
For your particular use case, where all files are to be mapped to the same user/group combo, you can use the --chown
option, which is a shortcut for the above.
In addition to Chris's answer, you can also edit your /etc/rsyncd.conf
and include the uid
and gid
you want the files to get in the relevant rsync folder.
Example:
[hadoop_out]
comment = hadoop_out
path = /mass1/mt_data/hadoop_out
read only = no
list = yes
uid = 26
gid = 26
auth users = postgres
secrets file = /etc/rsyncd.secrets
hosts allow = 10.11.20.61
That way, the files will be sync'ed and saved with uid
and gid
26
of user postgres
so you will not have to provide this info in the command you run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With