LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   howto folder/file sharing with specific groups (https://www.linuxquestions.org/questions/linux-newbie-8/howto-folder-file-sharing-with-specific-groups-231987/)

kmhui 09-17-2004 07:34 PM

howto folder/file sharing with specific groups
 
i have a folder which i only want to share with specific groups. How do i go about doing that.
assuming:

folder : /myfolder
groups : grp1, grp2, grp3

/myfolder is owned by grp1 and i wish to only share the folder with grp2 and not grp3.

i used the following command:

chmod 775 /myfolder

which only sets permission for read+execute for all groups(grp2 and grp3)

thks,
kmhui

ToniT 09-17-2004 08:04 PM

You can do this either by using ACL (if your kernel/fs supports those), or with some tricks:

If you just want to deny access from grp3, you can symlink that dir to
eg. /foo/denyGrp3/bar and set denyGrp3 to have access modes (705, root:grp3).

To allow (read)access of both grp2 and grp1, but no others and rw to grp1, you have to make a new group containing members
of both of those groups and do something like:
/foo/allowUnion/bar with allowUnion having access (750, root:union). And bar with flags
775 root:grp1

kmhui 09-17-2004 11:54 PM

if i understand you correctly,

If you just want to deny access from grp3, you can symlink that dir to
eg. /foo/denyGrp3/bar and set denyGrp3 to have access modes (705, root:grp3).


this is to create a symbolic like as in:

ln -s /myfolder /foo/denyGrp3/bar

where the owner grp is grp3. afterwhich, to set the permission on this symbolic link with respect to grp3 with the following where 705 denies grp3 the owner group but rx 705 for all other grps.

chmod 705 /foo/denyGrp3/bar

To allow (read)access of both grp2 and grp1, but no others and rw to grp1, you have to make a new group containing members
of both of those groups and do something like:
/foo/allowUnion/bar with allowUnion having access (750, root:union). And bar with flags
775 root:grp1


this approach is to make a new group comprising all members of grp1 and grp2. (grpunion) and create a symbolic link owned by grpunion

ln -s /myfolder /foo/allowUnion/bar
chmod 750 /foo/allowUnion/bar

i don't quite get the last part bar with flags 775 root:grp1.
is this to create another new symbolic link with the same name /foo/allowUnion/bar owned by grp1, or a different symlink name?

sounds like a whole lot of symlinks to accomplish granular permission settings. is there an equivalent such as with windows where for each folder or file, one can decide the set of permissions for any selected groups or users?

kmhui

suowei1979 09-18-2004 02:45 AM

:)

ToniT 09-18-2004 05:51 AM

Yes there are an equivalent; the ACLs (or trustees patch).

ok, the case 2 again:
What we want, is that grp1 has rw access to some directory, grp2 only r access and others no access.

Code:

mkdir -p -m 750 /mnt/thediskWhereEverItIsMounted/myDir/onlyGr12
mkdir -p -m 775 /mnt/thediskWhereEverItIsMounted/myDir/onlyGr12/data
chown root:grpunion /mnt/thediskWhereEverItIsMounted/myDir/onlyGr12
chown root:grp1 /mnt/thediskWhereEverItIsMounted/myDir/onlyGr12/data
ln -s /mnt/thediskWhereEverItIsMounted/myDir/onlyGr12/data /myfolder

Now /myfolder has such access.

kmhui 09-18-2004 07:05 PM

this is very concise. there's lots more to learn for me in Linux but it has been impressive and enjoyable so far. shall try out your codes.

thks.
kmhui


All times are GMT -5. The time now is 06:45 PM.