lighttpd - Run PHP script as the file's owner
Thanks in advance.
2 Replies
If so, there are two possibilities. One is to set the group ownership of the files to lighttpd's group, and set the user ownership of the files to whichever user that you want to own that site. For example, if lighttpd is assigned to group www-data, and you have a user called user1, the files for user1's site would still be owned by user1, so he can still access and modify his files directly, but the group ownership would be www-data. You would then allow the www-data group to have read and execute permissions on the files, and you would also allow write permission to www-data for the upload directory (if any) if you want to allow people connecting to the site to upload stuff. This will, of course, allow your users to add malicious php files to their web site directories, so you have to be careful.
The other way to do this is to set the user ownership to lighttpd's user, but to change the group instead. You can either have one group per user, and assign ownership of each site to their respective groups, or you can create a single group, for example wpusers, and add all your users to the wpusers group. Then you can change the group ownership of any wordpress directory to wpusers and assign the necessary read, write, and execute permissions that way. This method not only allows your users to upload malicious php files, they can mess with each other's sites if you use this method, so this method is less secure than setting the ownership on a per-user basis.
You'll probably want to decrease the number of children spawned by each instance, as well -- your RAM usage will be dictated by the total number of children across every instance.