Xref: utzoo comp.unix.questions:4781 comp.unix.wizards:5726 Path: utzoo!mnetor!uunet!husc6!bbn!aoa!mbr From: mbr@aoa.UUCP (Mark Rosenthal) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: Setting up groups Message-ID: <578@aoa.UUCP> Date: 14 Dec 87 20:19:57 GMT References: <4718@well.UUCP> Reply-To: mbr@aoa.UUCP (Mark Rosenthal) Organization: Adaptive Optics Assoc., Cambridge, Mass. USA Lines: 36 In article <4718@well.UUCP> samlb@well.UUCP (Samuel B. Bassett) writes: > How do you assign a user to more than one group? Depends on the version of Unix you're working with. I believe the AT&T family still does things the way they were done way back in version 7 (the (approximate) common ancestor of the AT&T and Berkeley Unixes). In these versions, logging in gives you a user id (UID) and a group id (GID). The GID comes from the group entry in the /etc/passwd file. This is your login group (i.e. the GID assigned to you when you log in). If you don't own a file, but your GID matches that of the file, your access is controlled by the group permissions on the file. The /etc/group file lists all the groups, and for each group it lists the accounts belonging to that group. You may change to another group with the 'newgrp' command. When you have done so, group file access will be governed by the group you specified as an argument to 'newgrp'. Thus, in version 7, System III, and System V.? you are logged into one group at a time. The group in the /etc/passwd file is used by the 'login' program. The /etc/group file is used by the 'newgrp' program. Berkeley had a better idea. They modified the kernel to keep a list of groups rather than a single group. Thus, when you log in they build a list consisting of the GID found in the /etc/passwd file and all the groups you belong to specified in the /etc/group file. If you don't own a file, but the GID of the file appears in your group list, your access is controlled by the group permissions on the file. You will see this scheme in the 4.?bsd versions of Unix. With this arrangement, there is no longer any need for a 'newgrp' command, so it was removed. Also, note that the group in /etc/passwd is not any more special than any of the groups you belong to by virtue of being mentioned in /etc/group. In 4.?bsd, there is really no longer any reason to have any group information in /etc/passwd. I assume they kept the field because it would have broken too many programs and shell scripts if they changed the format of /etc/passwd. And as long as you've got the field there, you might as well make it part of the group list along with the info in /etc/group. -- Mark of the Valley of Roses ...!{harvard,ima}!bbn!aoa!mbr