Sharing a directory among multiple users

The Filesystem Hierarchy Standard does not specify where to share files among users, it does hint at making directories under /home for groups to share group files in those directories:

On smaller systems, each user’s home directory is typically implemented as a subdirectory directly under /home, for example /home/smith, /home/torvalds, /home/operator, etc. On large systems (especially when the /home directories are shared amongst many hosts using NFS) it is useful to subdivide user home directories. Subdivision may be accomplished by using subdirectories such as /home/staff, /home/ guests, /home/students, etc

It is also common to use /srv as a place for sharing files among a server’s users. The FHS rationale for /srv is:

This main purpose of specifying this is so that users may find the location of the data files for a particular service, and so that services which require a single tree for readonly data, writable data and scripts (such as cgi scripts) can be reasonably placed. Data that is only of interest to a specific user should go in that users’ home directory. If the directory and file structure of the data is not exposed to consumers, it should go in /var/lib

An interpretation of this quote is that access to the files on the server are a service and therefore shared files should go in there. It does, probably, still make more sense to do development work outside of /srv.

Sharing a git repository among multiple users

When initializing a repository use the flag --shared to make the repository group writable. Do not use the same flag when doing clone, because it does something else. When doing clone do --config core.sharedRepository=true.

Once that is done, change ownership of all files and directories within the directory recursively chown -R SOME_USER:SOME_GROUP SOME_DIR

You might also need to make sure that the group has appropriate permissions for files and directories. You can modify permissions with chmod and use find to specify what to change the permissions of.

Change the permissions of directories:

sudo chmod 775 $(find SOME_DIR -type d)

Change the permissions of files:

sudo chmod 664 $(find SOME_DIR -type f)

Users who are part of the group that have access to the git repository should now be able to work without any additional permission issues. If there are, I need to update these notes.