I am setting up shared hosting. My users have SFTP access to the server to download their contents. I use separate PHP processes that work as their respective users (one per site). I want users to not see the contents of other users by default (with the exception of the web server like any other unprivileged client), but the web server (acting as the www-data user / group) should be able to read everything. Right now I am transferring ownership of files on the WWW to individual users and the group for www data and using the GID bit to distribute the ownership of the groups to new files / directories (users are not in the www-data group).
This worked well, but now I am facing a problem. Some sites use wordpress, and when they upload files, the GID set bit is lost, which means that the web server does not have access to it. Is there a way to configure PHP or Wordpress (more likely) on chmod files and directories for the correct permissions?
Note. I do not use safe mode in PHP, so it should be able to add the set GID bit.
Update: I tried setting the values โโof FS_CHMOD_DIR and FS_CHMOD_FILE in the wordpress configuration. I assumed that this would allow me to chmod uploaded files to everything I wanted. However, this did not affect the permissions of the new downloads. From the information in codex, I think that these settings apply only to the kernel update function.
Thanks!
source share