I have multiple users with apache installed on ubuntu 14.04 server.

How should I set user's groups or/and their home dir permissions so users could not read each others home dirs, but on the other hand to let apache read their home dirs (virtual hosts are set so that all users have their own subdomain located in their own home dir).

So it should be critical that users cant read other users home directories nor their virual host dir (/home/other_user/www/), but apache should be (obviusly) allowed to read their "virual host appointed" (/home/other_user/www/) dir


Add the the corresponding user groups to the apache user and make the files group readable (and maybe writeable depending on your needs).

Sorry for the lack of examples and formatting, I'm currently on the go and tying this on my phone ;). Maybe someone else can edit in the appropriate commands to use

  • that would solve direct access for other users home users, but i think that users can read other users code in their /www/ dirs using apache (file_get_content("/home/other_users_dir/www/index.php")). i have no idea how to solve that problem... – inemanja Dec 11 '15 at 10:20
  • 1
    oh wow, thats a thing i havent thought about lol. Well, if you want the files readable by the webserver, which of course it should be since otherwise the webserver cannot do anything, I dont think you can stop users from doing that. Im not sure about apache, but I know with my setup (nginx with php-pfm) i can settup multiple php-runners each for one user, running as that user, so the runner can access the files, but nobody else can. – Olle Kelderman Dec 11 '15 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.