16

I'm migrating a lot of small custom scripts and data from a Linux system to another.

On the old system we had a shared user that owned most of the files and they where located in that users /home, but on the new one we would rather login with our own accounts and use group permissions to collaborate, but as there won't be a single owner of the files, there is no /home-dir.

So where should I put those shared files? Should I create a no-login-user that owns the files? Or is there a suitable /grouphome-like place?

(I don't want to spread them out in individual users /home:s.)

Daniel
  • 165
  • 1
  • 1
  • 8

4 Answers4

15

I'd almost certainly suggest using /usr/local.

Globally accessible user scripts can be placed in /usr/local/bin. Small amounts of associated data could also go into bin. Or you may wish to separate out the data into /usr/local/var or /usr/local/share.

By doing this you'll be quite sure that anyone FHS familar will be able to locate them pretty quickly without any prior knowledge of the particular system.

Dan Carley
  • 25,189
  • 5
  • 52
  • 70
  • 3
    (+1) For future reference of what to put where: http://www.pathname.com/fhs/pub/fhs-2.3.html – Kyle Brandt Oct 29 '09 at 11:24
  • Thanks both of you. `/usr/local` be it. Actually it was one of my first options, but [the description of the purpose](http://www.pathname.com/fhs/pub/fhs-2.3.html#PURPOSE18) of `/usr` (read-only) in the suggested article turned me away from that idea. Guess I should have read on to `/usr/local`. – Daniel Oct 29 '09 at 12:12
  • Why not /srv as mentioned in https://unix.stackexchange.com/questions/70700/whats-the-most-appropriate-directory-where-to-place-files-shared-between-users ? – Mitesh Budhabhatti Apr 13 '21 at 08:12
7

It is exactly the sort of thing that group rights are designed for. This is how I do it in Ubuntu:

sudo mkdir /home/shared
sudo addgroup shared
sudo chown :shared /home/shared
sudo chmod 770 /home/shared
sudo vim /etc/group

Add the list of users who are to have access to the shared directory to the shared group. For example:

shared:x:1002:norman,nextuser,and,so-on

You can, of course, use any name other than 'shared' and it does not have to be in the /home directory. The nice thing is that you don't need to do anything special to the user's accounts and you can easily add or remove users from the group.

simplr
  • 520
  • 5
  • 11
  • Thanks for the down-vote. But I would like to know what I have written that is incorrect. – simplr Nov 18 '09 at 10:58
  • also set the group sticky bit, so that the group is set for new files created. `chmod g+s /home/shared` – jris198944 May 13 '14 at 08:43
  • 1
    @jris198944 `s` is for SUID and GUID bits, `t` is for sticky bit. Double check before posting, please ;-) See : https://unix.stackexchange.com/a/79401/136321. – leaf Apr 08 '18 at 17:05
1

The short answer is; Wherever you like :)

I like to use something like /projects, /shared or /common. /home/shared works too.

Roy
  • 4,256
  • 4
  • 35
  • 50
  • Thanks. Short and nice, but sometimes it's easier if you don't have to make up your own mind ... Would it be FHS-compliant to put my own directory right under `/`? When (if at all) does it matter? I'm not experienced enough to realize the implications of my choice. – Daniel Oct 29 '09 at 10:48
  • Those are really just conventions. Other programs that look for stuff my look in these predefined locations. The bin directories will already be in your $PATH so you won't have specify the full path name to run the script. Other admins might expect them to be there. It probably doesn't really matter in your case, but good habits are good :-) – Kyle Brandt Oct 29 '09 at 11:43
  • There are a number of applicable conventions is UNIX environments. The FHS makes for a good baseline, but it is quite common to deviate from this standard. For example the Optimal Flexible Architecture for Oracle database servers use /u* (/u01, /u02) for local user data while Ubuntu among others use /media for removable media mount points. As long as you have a convention that you agree on internally in your operational environment, there should be no issue. – Roy Oct 29 '09 at 12:36
0

I use /shares; this is also the location that qnap uses.

In /shares I have a symlinks to destination in a folder called /shares/.mnt/ where I have the mounted data drives.

This is done to prevent long wait times when moving files between shares when using hardlinks in /shares which are needed when data drives are only mounted in /mnt.

/shares/.mnt is not shared, by the way.

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92
Jeroen
  • 1