SUMMARY: Working in a group owned directory

From: Zohreh Shahbazi (zohreh@presto.STD.Teradyne.COM)
Date: Tue Oct 26 1993 - 03:46:01 CDT


Original Message:

>I am looking for a one step process to allow a group of people to work
>in a directory (read/write) and preserve the group read/write protection
>and group names on all the files. These files are not programs, or source
>codes. They are just some documentation that need to be modified by a
>group of people, so SCCS would not be appropriate for this purpose.
>
>What I am recommending currently is:
>
>1. newgrp <group-name>
>2. cd <group-dir>
>3. umask 007
>4. Do your work
>5. exit
>
>This is obviously too many steps, and users want a more automated way
>of doing this. Please let me know if there is an easier way of doing
>this on UNIX.
>
>zohreh@std.teradyne.com

Thank you to all who responded. Almost every one suggested setting
the sticky bit on group for the group directory which eliminated the need
for doing a newgrp. newgrp creates a new shell and that was my reason for
not being able to do it from a script. This is what I ended up doing:

1. Create a directory for this group with the setgid permissions:

                mkdir <dir-name>
                chmod 770 <dir-name>
                chmod g+s <dir-name>

2. Create a group in /etc/group NIS data base.

3. Create a netgroup entry in the master NIS netgroup file for hosts
    to be mounting this project directory.

4. Export the directory in /etc/exports file to the netgroup entry.

5. Run exportfs on the exported partition.

6. Write 3 shell scripts (setproject-<projname>) and setproject-home
    to save the user's umask, set his umask to 27 to allow group write
    and change directory to the new directory.

        setproject-<projname> script:
        -------------------------------
        #!/bin/csh
        if (! $?DEFAULT_UMASK) then
                        setenv DEFAULT_UMASK `umask`
        endif
        umask 27
        cd <projname>
        pwd

        setproject-home script:
        -----------------------
        #!/bin/csh
        if ($?DEFAULT_UMASK) then
                umask $DEFAULT_UMASK
                  unsetenv DEFAULT_UMASK
        endif
        cd
        pwd
    
7. Set up a mailing list for this group and send mail to them advising
    them to set an alias to source the setproject-<projname> and
    setproject-home to go back and forth between the group project and
    the home directory. The aliases will look like:

        alias projname 'source /usr/std/tools/setproject-projname'
        alias home 'source /usr/std/tools/setproject-home'



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:26 CDT