So I have a web-server that i rsync to from my personal computer, I'm having trouble with file permissions.
I have tried both of these commands, and none of them give me what I want.
rsync -a --no-o --no-g --exclude='*.json' --exclude='venv/*' --exclude='*.sh' /var/www/mysite.com/ firstname.lastname@example.org:/var/www/mysite.com rsync -a --exclude='*.json' --exclude='venv/*' --exclude='*.sh' /var/www/mysite.com/ email@example.com:/var/www/mysite.com
Here is an explanation of what I want, and what actually happens, I get the same effect with both of the commands mentioned earlier. This is how it should be, the index is readable by www-data which is the user nginx runs under, and writeable by the admin user.
-rw-r----- 1 admin-user www-data 127 M D mm:ss index.html
This is what actually happens after running rsync:
-rw-r----- 1 admin-user admin-user 128 M D mm:ss index.html
This obviously results in a 404 when visiting the website, currently I have to run a script that corrects permissions after running rsync.
So what I want is for the GID in the files on the server to not change after I run rsync, a solution where I manually specify a GID will not work either because there are other files used by other programs which need to be set to other groups. Basically rsync should modify the data in the files but not touch anything else.
This shouldn't require super-user privileges either, as the file is writeable by the user I am logging in as.
OS: Ubuntu 16.04 Server and Desktop rsync --version (home computer): 3.1.2 protocol version 31 rsync --version (server): 3.1.1 protocol version 31