You are not logged in.

#1 2006-08-10 13:36:17

becho4
Member
From: Galicia, Spain
Registered: 2004-12-09
Posts: 84

Shared directory

How can I share a directory among users in same group?

I tryed:
groupadd shared
useradd -d /sharedData -g shared admin
useradd -g shared usr1
useradd -g shared usr2

chown -R admin:shared /sharedData
chmod -R 2775 /sharedData

But when usr1 creates a new file in /sharedData it has rw-r--r-- permissions and is owned by usr1:shared, and usr2 is unable to modify it.

Suggestions please
Thanks in advance
smile

Offline

#2 2006-08-10 14:27:14

jaboua
Member
Registered: 2005-11-05
Posts: 634

Re: Shared directory

I belive that there is a special variable that decides the new file permissions - I can't remember the name, but IIRC it's oppocite from the octal permissions so that the variable value of 000 means permissions of 777 and a variable value of 777 means permissions of 000 if you understand what I mean.

Offline

#3 2006-08-10 16:12:53

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,718
Website

Re: Shared directory

If I understand what you want, you need to:
1. Create the shared directory (say sharedfiles).
2. as root issue the command chmod 2770 sharedfiles (this will make the directory shared by all the users in a group with RWX )
3. issue chown root:groupname sharedfiles ( this gives ownership of this directory to root and the particular groupname you have selected )
4. Add the users you want to share the files to the same groupname

Notice that if a user in the group create a sub-directory the subdirectory will only be accessible by that user.

Hope this helps.

Offline

#4 2006-08-11 14:12:10

becho4
Member
From: Galicia, Spain
Registered: 2004-12-09
Posts: 84

Re: Shared directory

You are right jaboua the new file permissions are set with umask. A default value of 022 is set in /etc/profile. Sadly umask sets new file permissions globaly, not in a specific directory.

ralvez, you understand right what I want and as you pointed out the problem is that if a user in the group create a sub-directory the subdirectory will only be accessible by that user.

I would like to be able to set non restrictive new file and directory permissions in the shared directory.

Thanks for your suggestions

Offline

Board footer

Powered by FluxBB