How to set up a multi-user shared hosting environment?

8,151

Solution 1

First use apache2-mpm-itk which change the user by VirtualHost. Define a user and its virtualhost, and define the permissions to 700. Nobody can read other user files. The files created in the VirtualHost by Apache is owned by the user and not by www-data.

Solution 2

The Apache Wiki has a page discussing the issues, and some solutions. See it here: http://wiki.apache.org/httpd/PrivilegeSeparation

Share:
8,151

Related videos on Youtube

CaptSaltyJack
Author by

CaptSaltyJack

Updated on September 18, 2022

Comments

  • CaptSaltyJack
    CaptSaltyJack over 1 year

    Bear with me, this is going to be tough to word clearly.

    Let's say I have a VPS account and I want to resell, and host a bunch of people on my server, giving them their own separate domains. Each user should be able to ftp in and upload files to their domain. The catch here is, Apache likes to run as a single process owner (usually www-data), and this creates a problem. I can check /etc/apache2/envvars to change the user/group to something else, but I need each user to have the proper rights to their own folders. And Apache needs to be set up in a way that the users don't have to set folders/files writable to a certain group in order for PHP to write to them (a la WordPress).

    How do I set things up to work this way, for a multi-user shared hosting environment?

    • rcomblen
      rcomblen about 11 years
      You could use php + suexec to run the php process as the user, no issue with file permissions then.
  • CaptSaltyJack
    CaptSaltyJack about 11 years
    Any potential issues with using ITK on a VPS with 1GB RAM? Apache's docs warn: "MPM-ITK, on the other hand, processes request headers under root, switches to the target userid, and then kills the httpd process when finished serving the connection. As discussed above, this has serious security and performance implications."
  • Dom
    Dom about 11 years
    I dont't think you will have a problem with that. It depends of your websites of course. It there is big PHP memory, there can be a problem in all the solutions