Changing GID inside csh script

Gary Weimer 253-7796 weimer at garden.ssd.kodak.com
Thu May 16 00:20:45 AEST 1991


In article <1991May14.182305.13872 at lonex.radc.af.mil>,
ratazzie at lonex.radc.af.mil (E. Paul Ratazzi) writes:
|> I have checked the FAQ and RTFM'ed on this one.  It seems like it should
|> be easy, but I'm having one heck of a time.
|> 
|> OS:  SunOS 4.1.1
|> 
|> Problem:  When a user executes our CAD software, I want all files he
|> creates while in the CAD software to have a group id of 'cad'.
|> Since these users are normally members of 'staff', the group id has to
|> be changed before the CAD software is executed.  I have found that this
|> can be done manually (and painfully) by typing 'newgrp cad' and then
|> starting the CAD software.
|> 
|>    What I would like is this group change to be automatic.  I have tried
|> everything I can think of from putting 'newgrp cad' in the csh script
|> (doesn't work because newgrp *always* gives another csh) to writing a
|> C code front end which calls setregid and then runs the script using
|> execve (doesn't work because the fact that I'm in sunview gets lost
|> somewhere along the line and the CAD software won't run without sunview).

How about doing:

example% chgrp cad <script>
example% chmod g+s <script>

(assuming <script> is the script that is being run)

This will change the group of the script to 'cad' and then set the group
id  on execution.

weimer at ssd.kodak.com ( Gary Weimer )



More information about the Comp.unix.questions mailing list