Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
4  
Voted up for mention of FHS! This *nix user and casual sys admin of 20 years had not known of it. Thank you! –  CPRitter Mar 31 '13 at 21:18
add comment

8 Answers 8

up vote 32 down vote accepted

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.

share|improve this answer
add comment

In my opinion, the right place is /srv/movies-enthusiast. A "service" does not have to be a daemon or program, it just has to be a service that the system provides (such as being able to get your movies there). Here's a quote from the FHS:

/srv contains site-specific data which is served by this system.

I definitely think your usage falls under that definition, and provides a service.

share|improve this answer
add comment

The Filesystem Hierarchy Standard (FHS) specifies a layout for "Unix distribution developers, package developers, and system implementors" to adhere to in order not to make a mess of your namespace.

As it is your namespace, you should choose any name you feel is suitable. If you find /groups/movies-enthusiast makes sense, you should put it there. If you like short path names because they are easier to type, /g/movies-enthusiast (or perhaps /g/m-e) would be suitable.

Because the paths you choose are not defined in the FHS, the distribution or third-party packages must not touch them. As such, you should read the FHS to know what paths may be used by compliant software (the table of contents will tell you most of what you need to know).

For example, I personally use /av for where I store my audio-visual content, /src for source code and /data for undefined data (such as virtual machine images, cd images, chroots, saved packages, etc).

share|improve this answer
    
I personally use /data for all such files, then /data/movies for audio-visual content, /data/src for source code, /data/music . all in one (hierarchical) place. –  meduz Apr 3 '13 at 20:40
add comment

There is nothing wrong with creating a new mount point or directory for this purpose from the root.

Particularly if this is the primary purpose of this system, I would just create

/movies-enthusiast

If there are other similar "groups", I may or may not prefer to host them together, eg

/data/movies-entusiast
/data/next-group
etc

or

/share/movies-enthusiast
/share/next-idea
etc

Questions to consider: Are you going to dedicate a mount-point for this purpose?

Have you considered softlinks?

In any case there are no rules. If you want to make one user the custodian and give the rest access to this project space, feel free to host it in the user's home directory. Or create a /home/shared/* name-space. You are your own boss.

Oh, one thing: Whatever you do, do document it. It needs to become part of system recovery, daily checks, backups, etc. Important configuration detains need to be noted (eg group memberships, permission sets, fs tunables for performance, and anything else that is not a default)

share|improve this answer
add comment

I'd personally opt for /usr/share/movies-enthusiast or /opt/movies-enthusiast

share|improve this answer
add comment

I suggest to create a separate directory like /opt/movies , set appropriate user and group permissions for them and also you can use disk quota to avoid total disk consume..

share|improve this answer
add comment

FHS is also to make admin easy so I would go with /srv for that reason though its not what I have done. Have perfect hindsight though. I use /export/srv because its on NAS.

If its a drop box then make sure that it is both setgid and sticky. Also ensure that those using it have a useful umask. However, don't use wheel as I have done in the example of file access modes. Don't strip eXecute or you will be in for a O_o surprise.

bash-3.2$ mkdir movies
bash-3.2$ sudo chmod 03771 movies
Password:
bash-3.2$ ls -ld movies/
drwxrws--t 2 andrewb wheel 68 Apr  4 17:09 movies/
bash-3.2$ umask 026
bash-3.2$ touch movies/junk
bash-3.2$ ls -l movies/
total 0
-rw-r----- 1 andrewb wheel 0 Apr  4 17:09 junk
share|improve this answer
add comment

This is as much a comment as an answer (so please don't downvote me for it!), but it's way too long to fit in a comment.

I do two things, both of which avoid the issue you're facing.

1) I make a separate partition of all the free space on my system disk and label it dataspace. That's where all my current media files and other data go. It gets automounted as /media/dataspace and I put anything that's "data" under a directory called "data" to separate it from things like work files, vms, or iso images that I don't want to routinely backup.

Using a separate partition has the added benefit that, if it fills up, it doesn't compromise my system like it would if it were stored under / or /home.

2) I put most of my data/media, especially things I'm not using "right now", on another physical drive (USB in my case with a notebook). That makes it easy to backup and easy to attach to another computer, should the need arise.

share|improve this answer
add comment

Your Answer

 
discard

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.