LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-17-2004, 07:34 PM   #1
kmhui
LQ Newbie
 
Registered: Jul 2004
Location: singapore
Distribution: fedora
Posts: 8

Rep: Reputation: 0
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
 
Old 09-17-2004, 08:04 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
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
 
Old 09-17-2004, 11:54 PM   #3
kmhui
LQ Newbie
 
Registered: Jul 2004
Location: singapore
Distribution: fedora
Posts: 8

Original Poster
Rep: Reputation: 0
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
 
Old 09-18-2004, 02:45 AM   #4
suowei1979
LQ Newbie
 
Registered: Sep 2004
Location: BeiJing,China
Distribution: Red Hat
Posts: 25

Rep: Reputation: 16
 
Old 09-18-2004, 05:51 AM   #5
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
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.
 
Old 09-18-2004, 07:05 PM   #6
kmhui
LQ Newbie
 
Registered: Jul 2004
Location: singapore
Distribution: fedora
Posts: 8

Original Poster
Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
assign a file/folder two groups? student04 Linux - General 2 12-19-2004 10:47 PM
How do I FTP into specific folder hrp2171 Slackware 3 10-18-2004 07:30 PM
Users, groups, permissions - specific task question Doctafonk Linux - General 2 04-21-2004 09:05 PM
Win2k - Mandrake9.1 -file(folder) sharing? al3s Linux - Networking 3 04-19-2004 02:59 PM
samba sharing with groups Mr-TY Linux - Newbie 2 06-18-2003 02:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration