Talking about this feature http://httpd.apache.org/docs/current/howto/public_html.html
Is there a way (HOW?) to have Apache take on (setuid) the ID of each "~user", instead of doing everything under the www-data userid?
There is a related question here: Apache per user permissions
In that question, one answer actually advises against doing what I'm asking:
If you were to run one apache instance for each user, and have that apache owned by the user, you'd thereby grant apache permissions to write to all of the user's directories. That's generally not considered a good idea at all.
The fact that the answerer stated that you SHOULD NOT do this, seems to imply that you CAN do it. So now I'm just asking HOW TO do it, because I have a very specific use-case that requires it, but running a separate instance for each userid is too resource-intensive. So, is there an easier way?
You might want to try Apache ITK MPM. It works like the traditional Apache prefork model, but assigns a different UID for each virtual host. And if you use Apache 2.4, you can use mod_rewrite to make
~/
paths to use the UID of that particular homedir as instructed by ITK MPM home page.Yes, you would enable SuExec.
https://httpd.apache.org/docs/2.4/suexec.html
Specifically, the section that begins Using suEXEC.
Quoted here for convenience:
You'll need to insure the '--with-suexec-userdir' compile time option is enabled in your Apache build.