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 |
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 |
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 |
:)
|
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 |
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 11:47 PM. |