The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to display the permission of the home directory nadman123 Shell Programming and Scripting 9 04-15-2008 05:09 AM
Problem about Fedora directory permission zhouq3132 Linux 3 04-13-2008 01:28 AM
how to add permission of directory to a group ahjiefreak UNIX for Dummies Questions & Answers 2 02-29-2008 03:20 AM
ssh home directory permission shihabvk UNIX for Advanced & Expert Users 1 06-25-2007 08:10 PM
related to directory permission mxms755 UNIX for Dummies Questions & Answers 1 04-06-2006 08:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 2.50 average. Display Modes
  #1 (permalink)  
Old 01-07-2009
StephenJH StephenJH is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
two groups with permission on one directory

Hi, I have a directory that needs to be accessed by the members of two groups:

group1 needs rw access
group2 needs only r access
others should have no rights

I must be missing something obvious, but I can't figure out how to do it! Any ideas?
  #2 (permalink)  
Old 01-08-2009
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
This is one of the major limitations of the standard Unix file permissions system. The only way I know of to achieve this using just one directory is to use ACLs (access control lists, see man getfacl/setfacl), but unfortunately these are not supported by all filesystems, or by all OS's and/or utilities... e.g. some backup software will not back them up.

This is unfortunate because they are very useful for some other things, such as setting default permissions on files and subdirectories created in the directory.

One other option you have is to use a structure like this:

Code:
drwxr-x--- user1 group2 topdir
   drwxrwsr-x user1 group1 subdir
       -rw-r--r-- user1 group1 files
Then ensure that all members in group1 are also in group2 (but not the reverse, i.e. group2 is a superset of group1). That way a user in group2 can descend to the /topdir/subdir directory, wherein they effectively have read-only rights by virtue of the "other" attributes. Users in group1 can descend into that directory too because they are also members of group2, and can modify the files because of their group write access. Users in neither group can't even enter the /topdir so they can't access the files at all.

You'll notice I have set the setgid bit on the subdir - this ensures all files in that directory are created with group1 ownership. You may also need to consider setting appropriate umasks for the process(es) that create files in this directory so that they are created as 664 instead of 644, i.e. umask 002.
  #3 (permalink)  
Old 01-08-2009
StephenJH StephenJH is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
Thanks Annihilannic, your solution is clever!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0