Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Apr 2001 10:56:42 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Aaron Hill <hillaa@hotmail.com>
Cc:        trond@ramstind.gtf.ol.no, freebsd-questions@freebsd.org
Subject:   Re: Is there an equivalent of newgrp in FreeBSD?
Message-ID:  <20010403105642.B71213@wantadilla.lemis.com>
In-Reply-To: <F41rhMOgRGkQ6mBySsx00002dc5@hotmail.com>; from hillaa@hotmail.com on Mon, Apr 02, 2001 at 10:53:33PM %2B0000
References:  <F41rhMOgRGkQ6mBySsx00002dc5@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday,  2 April 2001 at 22:53:33 +0000, Aaron Hill wrote:
>> The command newgrp exists on SysV inspired systems such as RISC/os and Red
>> Hat GNU/Linux. Its purpose is to change the effective gid of the user
>> running the command. The user may choose only from the groups he/she is a
>> member of.
>>
>> What is the BSD equivalent, if any?
>
> There is none that I know of. I've just come back from a week of
> Solaris training and on the course it was explained that Sys V only
> allow a user to be a member of one group at any one time, so the
> newgrp program was necessary to swap the user to another group when
> required. In BSD a user can be a member of several groups (maximum
> 32?) *concurrently* so there is no need for this type of program.

Funny about this.  I was just researching it yesterday.  Can you say
what happens under Solaris if I (user grog) am a member of groups
lemis and wheel, and my currently active group is lemis, when I try to
open this file?

-rw-r-----   1 root  wheel     94 Mar 31 10:45 foo.c

On FreeBSD, it will work, because there's no concept of "currently
active group".

Somebody told me that it would work under System V as well, and that
the current group was simply the group to which newly created files
would belong.  Under FreeBSD you don't get a choice of ownership of
new files: they belong to the same group as the directory does.  If
you want a different group, you need to change it explicitly.

>> BTW, is the use of the password field in the group file implemented
>> in FreeBSD, or other Unices for that matter?
>
> Solaris uses this field. To get a password into the field you have to copy
> and paste it from /etc/shadow. The password is then used by the newgrp
> command. I don't know about FreeBSD but for the above explained reasons I
> don't see why this field would be needed... ?

According to group(5), it exists.  I haven't checked the source code,
but I also can't see what use it might be.

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply.
For more information, see http://www.lemis.com/questions.html
Finger grog@lemis.com for PGP public key
See complete headers for address and phone numbers

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010403105642.B71213>