I've set up a web server of which will host sites for multiple clients, each client will have their own user and the files for their website(s) will exist within /var/www
.
We deploy code via a service called DeployHQ, of which connects via SSH using the clients username, thus when files are pushed to the server they are created with that clients username and group.
The issue I'm having is that the web server user www-data
isn't able to update files, for example this .htaccess
file:
4 -rw-rw-r-- 1 client_user client_user 945 Oct 30 12:07 .htaccess
I could just change the file group to www-data
, however new files that are deployed won't be created in this way so this wouldn't be a long term solution.
Considering I want a user for each client, can anyone recommend a way to allow www-data
to do anything that the client user can do?
I've just read a little bit about setting the Set-Group-ID
, is that something I should consider?
Many thanks
This can be achieved by setting the SGID bit on the dirs for each user. For example:
Remember to make sure your umasks for the users put the right group permissions on the files too!