Subject: Re: bin/792: su(1) ignores primary group, it and id(1) disagree with kernel on group membership
To: Daniel Carosone <dan@anarres.mame.mu.oz.au>
From: Jason Downs <downsj@PEAK.ORG>
List: netbsd-users
Date: 02/10/1995 16:55:21
In message <199502110005.QAA00367@sun-lamp.cs.berkeley.edu>,
	Daniel Carosone writes:
>I discovered that, while id(1) told me I was in group 0, su(1) told me
>I was not in the correct group to su.
>
>The su(1) program uses the getgrgid() function, which reads the
>/etc/group file for secondary groups. It does not look at the primary
>group. id and su should agree, this is clearly a bug, and a simple one
>to fix.

I'd say this is a bug.  su(1) and id(1) should agree.

>I went to the source of id(1) to see how it extracted the secondary
>group membership from the kernel, so as to use the same mechanism in
>su(1).  I discovered that id also uses a variant of the /etc/group
>database file access routines, and so there is the possibility for
>disagreement between id(1) and the kernel.
>
>I find it very confusing when id tells me I am in the right group to
>su, and I can't, or when it tells me I am in the right group to access
>a file, and I can't.

This is how UN*X has been for a very long time.  Changing it would
certainly `feel' wrong.  A newgrp(1) command might be nice, though.

--
                  //---------------//------------------------//
		 //  Jason Downs  //  downsj@CSOS.ORST.EDU  //
                //---------------//------------------------//