I am using Rsync to deploy to a remote server, which is working. However the file and directory ownership always replaces old files with root:root
I need the ownership of all files and folders transferred to the destination folder on the remote server to be changed to www-data:www-data.
I need to access the server as root via ssh, as I don't have the password for www-data. At the moment I have to transfer all the files, and then run the chown command in Terminal afterwards, but I'd like to automate this.
At the moment I am trying the following, but it doesn't work or transfer any files.
'rsync -rlDvz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" –progress –exclude exclude
–exclude .htaccess –exclude site/accounts source
root@ip
:dest
&& chown -R user
:group
dest
'
Thanks
Best Answer
Try
rsync -aAX
This should transfer both ownership/group and extended attribute (eg: selinux)