How do I set up a shared directory on Linux?

Posted by JR Lawhorne on Server Fault See other posts from Server Fault or by JR Lawhorne
Published on 2009-07-23T20:25:05Z Indexed on 2010/06/18 12:54 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

I have a linux server I want to use to share files between users in my company. Users will access the machine with sftp or secure shell.

Here is what I have:

cd /home
ls -l
drwxrwsr-x  5 userA         staff      4096 Jul 22 15:00 shared
(other listings omitted)

I want all users in the staff group to be able to create, modify, delete any file and/or directory in the shared folder. I don't want anyone else to have access to the folder at all.

I have:

  1. Added the users to the staff group by modifying /etc/group and running grpconv to update /etc/gshadow

  2. Run chown -R userA.staff /home/shared

  3. Run chmod -R 2775 /home/shared

Now, users in the staff group can create new files but they aren't allowed to open the existing files in the directory for edit. I suspect this is due to the primary group id associated with each user which is still set to be the group created when the user was created. So, the PGID of user 'userA' is 'userA'.

I'd rather not change the primary group of the users to 'staff' if I can help it but if it is the easiest option, I would consider it.

And, a variation on a theme, I'd like to do this same thing with another directory but also allow the apache user to read files in the directory and serve them.

What's the best way to set this up?

© Server Fault or respective owner

Related posts about linux

Related posts about permissions