Subject: Re: bin/11047: newgrp is missing
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 04/27/2002 15:20:12
>> >What exactly is newgrp good for on a system that allows users to be in
>> >more than one group at a time?
>> 
>> On SYSV, using newgrp allows one to create files with a particular group
>> ownership. On NetBSD one would use chmod.
>
>I don't think newgrp would help in this case, because the 4.4BSD semantic is
>to create new files with the group of the directory if the user is allowed
>to.
>A newgrp would only help in case of file creation in a directory which groups
>is not in the user's group list.

that already works.

	> ls -ld .
	drwxrwxrwt  2 root  47  512 Apr 27 11:27 ./
	> id
	uid=204(andrew) gid=20(staff) groups=20(staff),0(wheel),9(wsrc)
	> rm foo
	rm: foo: No such file or directory
	> touch foo
	> ls -l foo
	-rw-r--r--  1 andrew  47  0 Apr 27 15:18 foo

oh, and for what it's worth:

	> chmod 2755 foo
	chmod: foo: Operation not permitted

i can't exploit that to gain extra permissions.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."