[SUMMARY] mkdir and group

From: Jukka Jalava <jukka.jalava_at_vat-vai.valmet.com>
Date: Wed, 31 Jan 1996 12:20:39 +0200

Only yesterday I asked:

> In HP-UX (System V UNIXes) when you create a subdirectory with mkdir, > it inherits the users effective ID and GID. In DU (at least OSF/1 3.2)
> it inherits the GID of the parent directory, and not the user! (I take > this is the way to do it in BSD UNIX)
>
> Using this from command line wouldn't be a major problem, but when
> it's built into scripts used by a make-system it gets rather tedious.
>
> Can anyone tell me if there is a way to tell mkdir what UID and GID to
> use?
>

A Big Heap Of Thanks To:

        alan_at_nabeth.cxo.dec.com
        Ken Teh <teh_at_chinook.phy.anl.gov>
        Dan Riley <dsr_at_lns598.lns.cornell.edu>
        Paul David Fardy <pdf_at_morgan.ucs.mun.ca>
        Jarkko.Hietaniemi_at_hut.fi (Jarkko Hietaniemi)

I was suggested to run the System V environment, but the solution that
works for me lies in the filesystem mount:

> If you mount the file system with the 'nogrpid' option, you'll get the
> SVID semantics.
>
> Read the man page for mount(8). The relevant options are grpid and
> nogrpid (the former is the default). If you mount the filesystem
> using fstab entries like the following samples, you'll get the SysV
> behaviour you were expecting.
>
> /dev/rz0d /usr ufs rw,nogrpid 1 2
> rz3#pkg /pkg advfs rw,nogrpid 1 2
>
> Note the if you set a directory's setgid-bit, files will inherit the
> directory's group structure.
>
> We don't use this option, though. We found that the BSD rules are more
> appropriate to handling groups and shared files. When we create a
> directory for members of group foobar to share, we want all the files
> in the directory to be owned by group foobar and, hopefully, readable
> and executable (as applicable) to every member of the group.
>
> The exceptions are usually apply to the creation of new direcotories.
> I find that this is more easily managed than the ongoing problems
> of user creating file with inappropriate group ownership.
>
> Paul Fardy

I have to agree with Paul there, BSD rules have their good sides.
Jarkko had the same solution and copied me the part of the manual:

> grpid
> New files inherit the parent directory's group ID. This is the default
> and matches BSD's semantics.
>
> nogrpid
> SVID III semantics applied. For example, if the parent directory's
> mode bits include IS_GID, then the new file will inherit the parent's
> group ID. If IS_GID is off, then it inherits the process group ID.
>
> ++jhi;

Tried it. Works. Thank you all once more.

-- 
     _____                               Jukka Jalava
    (  	 /       /_   /_   __          System Specialist
    ____/__/  / /__) /__) /  /       Valmet Automation Inc. 
   (___/  (__/_/ (__/ (__(__/(          Tampere FINLAND 
                                 jukka.jalava_at_vat-vai.valmet.com
                                  tel: +358 31 2668 690  (GMT+2)
Received on Wed Jan 31 1996 - 11:53:07 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT