From owner-freebsd-questions Mon Apr 2 18:26:52 2001 Delivered-To: freebsd-questions@freebsd.org Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by hub.freebsd.org (Postfix) with ESMTP id 557F637B720 for ; Mon, 2 Apr 2001 18:26:45 -0700 (PDT) (envelope-from grog@lemis.com) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id EF3B56ACB7; Tue, 3 Apr 2001 10:56:42 +0930 (CST) Date: Tue, 3 Apr 2001 10:56:42 +0930 From: Greg Lehey To: Aaron Hill 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> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from hillaa@hotmail.com on Mon, Apr 02, 2001 at 10:53:33PM +0000 Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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