Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a home server with Ubuntu 12.04 Server (using an old Netbook with an Atom CPU and 512Mb). The idea is just to be used for a small team (maximum 10 persons) that will have constant access by SSH to the main projects and could add features with Git, and will, as well, have their own directory (with VirtualHost configured) for their own personal projects.

Everything is configured and running, but my question is :

What is the best solution here for everyone to work? It is to have them on the http group and then all have access as normal users to the /var/www folder (that also contains GitWeb and Drupal), or would be to create a new user named after the project (as an example) where only those with the password could have access to work (configured with VirtualHost).

Notice: The idea is to have 1 person responsible of the server directly (since he is the one who is hosting it), 2 more people that will have access to the root from their home in order to configure anything from their home, plus anyone else that joins the group without any root access, but just the necessary access to create personal works and work with Git.

share|improve this question
up vote 1 down vote accepted

There are 2 separate questions, one about setting up Apache and another about setting up git.

Regarding Apache: there is no need to give access to /var/www to everyone, Apache supports per-user web directories, so, after you enable per-user directories with a single line in the config, users should be able to add files to public_html directory in their home directory and have it served at

Regarding Git: the trick here is to add all users into a group and then make sure the repository on the server is created with --shared flag and is owned by that group. I'm using a script for that:


echo "Creating new repository: " $1
git --bare init --shared
git update-server-info
chown -R apache:apache $BASE/$REPONAME
echo "Done."
echo "SSH clone URL is ssh://$REPONAME"

Such repository needs to be created by a super-admin user, but after that everyone will be able to push and pull from it. If a user needs a private repo, they can just create one in their home directory.

share|improve this answer
I know about the per-user web directory, but I wanted (beside a per-user web directory) a one directory for everyone so they could edit directly the code from it (even if the Git repository would be used as the one and only for all the modifications). Am I thinking about this in a wrong way :s. ? (PS: Thank you for the git tip I didn't knew about that :D) – aliasbody Nov 5 '12 at 23:39
A common folder where different people edit code is a recipe for disaster. If you're thinking of organizing any kind of "development workflow", a better solution would be to make people to push code to a common repo and then update the web server by pulling from that repo. Otherwise why bother with git and everything - just give everyone sudo rights and let them override each other's work in the common directory... – Sergey Nov 6 '12 at 0:03
I think you are right about that... Maybe I should be the only one with root permissions and then give only access to git and personal directory. Thank you for this help :D – aliasbody Nov 6 '12 at 1:32

Your solution will probably work okay. You just need to make sure that Apache is able to read the files in /var/www.

As an alternative, you can always install apache2-mpm-itk, which will allow you to configure virtual hosts running as users other than the one that Apache runs as (normally www-data). More info about apacke2-mpm-itk here.

share|improve this answer
I will have a look at this thanks :D – aliasbody Nov 5 '12 at 23:41

The best solution is not to have anyone but the server administrator ssh or remote into the machine. Instead, have each developer work on their own machine, and each person just does git pull/push to fetch code from the central server branch. That way, the work that each person does is completely independent except when they are merging changes from others. Git will take care of all of the permissions, all you would need to do is make sure every developer has a login account to use.

Please refer to the "Using git for collaboration" section of this document:

You may also be interested in the "Distributed workflows" section of this document:

share|improve this answer
So what you are suggesting is. Only access to per-user directory (so localhost/~user1 etc...) and then for the collective work only the Git repository ? But how could the rest of the 2 persons that are the Admin Team manage the server per se if I'm not available :s ? – aliasbody Nov 5 '12 at 23:41
Yes, that's what I'm suggesting. Having multiple admins on the box is a separate question from having multiple developers and should be asked separately. – ImaginaryRobots Nov 6 '12 at 0:33
Thanks for all of the suggestion I think that I found the perfect way to solve this problem :D Thanks for your help – aliasbody Nov 6 '12 at 1:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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