[comp.unix.questions] newgrp type command

rick@comspec.uucp (Rick McCalla) (04/11/90)

We are currently running SCO Xenix 2.3.3 - 386 version.

The users on our system are all broken down into a variety of groups (gid)
and must change group association for each package that they want to run.  At
login they are exec'd into a aprogram that runs them through the various
packages.  When they need to run a package belonging to another group they
exec a program that has the sgid bit set to the appropriate group.

I am trying to find a way of using newgrp in a manner similiar to 
'su groupname -c "run this program' but am having no luck (newgrp also
creates a new shell).  Ideally this should be a little program that checks the
/etc/group file for access permission to the group and then changes the gid
and exits.  If no permission is granted by /etc/group then the program should
still exit without error but also without changing the gid bit.

This program would be used on a command line to prefix the calling of the
other program.

Any help would be greatly appreciated.
Rick

-- 
Comspec Communications Inc.  | Rick McCalla  ----- rick@comspec.UUCP
Toronto, Ontario  Canada     |----------------------------------
Voice : (416) 785 - 3553     | Path:  uunet!mnetor!becker!comspec!rick
Fax   : (416) 785 - 3668     |