1

Software Versions

Ubuntu 14.04
Apache 2.4.7

I have a small web server set up and have about 5 users for whom I host websites. My web structure is like this:

/var/www/user1

/var/www/user2

/var/www/user3

/var/www/user4

/var/www/user5

In Apache, I've created virtual hosts for each domain that points to the correct directory in my web directory setup. Everything works fine and as expected.

The problem has to do with user access...

I've created a group called www-users and I've added each of my 4 users to this group. Now, I need to make sure that anyone who is in the www-users group can read/write to the /var/www directory (preferably only their own, but I understand that can be done via an sshd configuration so let's ignore that).

Can anyone help me solve this? I've searched Google for a few days and am finding very contradictory answers. What is the proper way to give a group access to a directory owned by root like /var/www is?

Thanks!

1

If you give group access to /var/www/ then any one of your users will be able to read/write/delete to other users' directories.

I would suggest:

chown -R user1 /var/www/user1
chown -R user2 /var/www/user2
... etc ...

and tell them to make their files and directories world readable (which they should be if they are exposed to the World Wide Web)

CGI and/or PHP would make this setup more complex but there was no mentioning of these in the original question...

  • Thank you for the quick answer. That works. Many thanks! – CajunTechie Feb 8 '16 at 23:37

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.