0

I'm transferring html pages to my web server with rsync with:

rsync -r -og --chown=transfer:www-data webpage/* transfer@myserver:/path/to/wwwfolder/

I use the transfer account (dedicated for data transfer and limited to rsync and scp by rssh); the transfer user is a member of the www-data group but its primary group is wizard; the www-data group is the primary group of the www-data user which is the user that runs the web server. The destination folder wwwfolder does not exists and is created by rsync.

With this setup I have two problems related to the destination folder wwwfolder:

  1. the created folder is owned by transfer:wizard, thus the web server cannot read its content. How can I tell rsync that the owner should be transfer:www-data? This owner is correctly set for the folder content by means of the --chown flag but the flag seems to be ignored for the container folder

  2. the created folder has drwxrw-rw- permissions, so even if I would be able to set the owner to transfer:www-data then it would still not be readable by the web server since the group does not have X permission. How can I specify the destination folder permissions to rsync?

Please note that I cannot simply login with ssh and use chown/chomd since the shell for the transfer user on the server only accepts rsync and scp commands for security reasons. The rsync version on both the server and the client is 3.1.2 protocol version 31.

  • Only the root user can write as any user/group. – Ipor Sircer Jan 29 at 11:38
  • But the transfer user is member of www-data, so why can't he create the folder with its secondary group? – Nicola Mori Jan 29 at 11:49
  • rsync runs as user transfer, and one user only has one uid and one gid. – Ipor Sircer Jan 29 at 11:51
  • I found a workaround: 1) I created a new user www-transfer with primary group www-data and use that for transferring data 2) I change the source folder permissions to drwxr-xr-x and call rsync with -a option which preserves the permissions – Nicola Mori Jan 29 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.