If I have photos, mp3s, books and other miscellaneous stuff that I want all users to able to access from a common directory, where on a Linux file system should I put that directory? In /usr/share, or just in /usr, or create a new top-level directory instead?
I usually put this in
/home/media, I create a
media unix group that owns it with a setgid bit.
As root, or using sudo:
groupadd media mkdir -p /home/media chown -R root.media /home/media chmod g+s /home/media
Then I put each user that needs to access these data in the
You could also use ACLs to manage each user's right for the directory.
You could also use
/srv/media if you prefer, but I like home for shared documents. Anything in
/usr is to be avoided for this unless you're talking about static files.
/av - it's nice and short so it's easy to type.
FHS compliance is not an issue. FHS is a standard for your distribution and applications to follow. A distribution or application should never create a top-level directory, but as a user and system administrator, the filesystem namespace is yours to use as you wish.
Putting it in
/home is a bad idea, as that directory is for home directories. Your shared media directory is not a home directory. Consider that if you use
/home/media and later need to create a user called 'media'.
Similarly, avoid directories that are managed by your distribution.
/usr/share/media is a bad idea, since a package in your distribution might well use that path.
/srv are defined places where you have control of the namespace underneath, but
/opt is usually for application directories and
/srv for data that the host is serving up.
/usr/local/share may be appropriate, but that's just too long a path for my liking.
Above all, remember it's your filesystem so there's nothing wrong with creating a new top-level directory.
According to the Filesystem Hierarchy Standard,
/usr is for "shareable, read-only data";
/usr/share is for "read-only architecture independent data files. ... for example, a site with i386, Alpha, and PPC platforms might maintain a single /usr/share directory that is centrally-mounted"
So yes, a subdirectory of
/usr/share seems like an appropriate choice.
Less pedantically, /home (as suggested by raphink) seems like a good choice. You probably have /home on its own partition, both so that you can easily blow away the rest of the OS without touching user data (eg, when doing an upgrade or reinstall) and for ease of backup (as everything you care to back up is stored under /home), and for space management reasons (on most home boxes, the partition with /home ends up being the one that runs out of space first).