Inheriting group ownership under Red Hat Linux?

Pete Nesbitt pete at linux1.ca
Thu Jun 24 03:12:46 UTC 2004


On June 23, 2004 05:20 pm, Carl Riches wrote:
> On Wed, 23 Jun 2004, alan wrote:
> > On Wed, 23 Jun 2004, Carl Riches wrote:
> > > For example, let's say that there is directory:
> > >
> > >     drwxrwxr-x    2 root     fugroup        4096 Jun  8 11:45 fubar/
> > >
> > > Let's say that user "riches" creates a file in directory fubar/.  The
> > > primary group for user "riches" is "staff", but that user also belongs
> > > to "fugroup" and can write to the fubar/ directory.  The file created
> > > in that directory is owned by "riches:staff", not "riches:fugroup".
> > >
> > > This breaks some things, e.g. file sharing between a working group.
> > >
> > > Does anyone know how to work around this?  That is, is this a known
> > > problem or do we have some sort of configuration problem?
> >
> > Look at the man page for "chmod".  You need to set the sticky bit for
> > group on that directory.
>
> We'd thought of that, but this is _not_ needed under other versions of
> Unix.  In fact, we discovered the problem when a working group tried to
> use a shared directory (via NFS) under Linux and under Unix.  Files
> touched by one user under Linux could not be used by any other user,
> while work done under Unix did not have this problem.
>
> I just tried your suggestion.  It failed.  I created a directory with me
> as the owner and a secondary group to which I belong as the group owner.
> I then ran "chmod 1775" on the directory.  Any file I create in that
> directory has my primary group as the group owner.
>
> How do I get the files to inherit the group ownership of the directory.
>
> Carl
>
> Carl G. Riches
> Software Engineer
> Department of Mathematics
> Box 354350			voice:     206-543-5082 or 206-616-3636
> University of Washington	fax:       206-543-0397
> Seattle, WA  98195-4350		internet:  riches at ms.washington.edu


Hi,
What Unix are you using? Solaris works the same as RH.

Anyway, use "chmod 2775 dir_name"  (not 1775 which sets suid)
That sets the directory to SGID and will result in any files or sub-dirs 
created within  'dir_name' will have the creators owner and the directories 
group. 
If you prefer letters instead of the nuimber permissions, 
it is "chmod g+s dir_name"

You may also want to run over the existing files with
 "chown -R  group_name dir_name"
-- 
Pete Nesbitt, rhce





More information about the redhat-list mailing list