Most Appropriate Directory for Files Shared Between Users

directory-structurefhs

Or: where can I put files belonging to a group?

Suppose there are two users on a Unix system: joe and sarah. They are both members of the movies-enthusiast group. Where should I put their movie files?

  • /home/{joe,sarah}/movies are not appropriate because those directories belongs to joe / sarah, not to their group;

  • /home/movies-enthusiast is not appropriate too, because movies-enthusiast is a group, not a user;

  • /var/movies-enthusiast might be an option, but I'm not sure this is allowed by the FHS;

  • /srv/movies-enthusiast might be an option too, however movies are not files required by system services.

Best Answer

Don't use

  • /usr is for sharable read-only data. Data here should only change for administrative reasons (e.g. the installation of new packages.)
  • /opt is generally for programs that are self-contained or need to be isolated from the rest of the system for some reason (low and medium interaction honeypot programs, for example).
  • /var is for "files whose content is expected to continually change during normal operation of the system---such as logs, spool files, and temporary e-mail files." I like to think of it like this: if your data wouldn't look right summarized in a list, it generally doesn't belong in /var (though, there are exceptions to this.)

Use

  • /home is for user home directories. Some see this directory as being an area for group files as well. The FHS actually notes that, "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."
  • /srv is an acceptable and often-preferred location for group files. I generally use this directory for group-shared files for the reason mentioned in Chris Down's answer; I see group file sharing as being a service that the server provides.

See the hier(7) man page (man hier) for more information of the purpose of each directory described by the FHS.

Related Question