Apache permission issues with virtualhosts

The main issue here is that Apache runs as a user (www-data by default) and sure you can go changing the user within Apache's configuration but then if you had someone else hosting a website on your server they would have issues with permissions because Apache wants to write as a single user and more of less likely that user does not have access to home directorys(or where ever your virtualhosts documentroot is located).

 So, some would argue why not just put it into /var/www/ folder and leave it's owner as www-data. That would be nice and all, but then you have issues with FTP access unable to write to the folder. It is also very bad security to change the FTP program to www-data writable.

The answer, apach2-mpm-itk basically add a small piece of code to each virtualhost's configuration and you tell it directly what user to use to write to the files.

Code:

AssignUserId username group

Replacing 'username' and 'group' with your username in both fields.

This tells Apache which user to be able to write to files as, but only for the virtualhosts directory.

Print