MicroBSD Handbook

Prev Next

7.8 Groups

A group is simply a list of users. Groups are identified by their group name and GID (Group ID). In MicroBSD (and most other Unix systems), the two factors the kernel uses to decide whether a process is allowed to do something is its user ID and list of groups it belongs to. Unlike a user ID, a process has a list of groups associated with it. You may hear some things refer to the ``group ID'' of a user or process; most of the time, this just means the first group in the list.

The group name to group ID map is in /etc/group. This is a plain text file with four colon-delimited fields. The first field is the group name, the second is the encrypted password, the third the group ID, and the fourth the comma-delimited list of members. It can safely be edited by hand (assuming, of course, that you do not make any syntax errors!). For a more complete description of the syntax, see the group manual page.

If you do not want to edit /etc/group manually, you can use the groupadd command to add and edit groups. For example, to add a group called micro and then confirm that it exists you can use:

Example of Adding a Group Using groupadd

    # groupadd micro
    # groupinfo micro
    	name    micro
	passwd  *
	gid     1002
	members

The number 1002 above is the group ID of the group micro. Right now, micro has no members, and is thus rather useless. Adding users to groups is done by usermod or manualy with a vi editor. See man pages for more info.

The user info (GID,UID) can be viewd by id program.

Example of Using id

    # id root
   	uid=0(root) gid=0(wheel) groups=0(wheel), 2(kmem), 3(sys), 4(tty), 5(operator), 20(staff), 31(guest)

As you can see, root is a member of the groups wheel, kmem, sys, tty, operator, staff, guest. The number in front of the brackets is the Group ID.


Prev Home Next
Limiting Users Configuring the MicroBSD Kernel

This, and other documents, can be downloaded from MicroBSD.

For questions about MicroBSD, read the documentation before contacting <MicroBSD Support>.
Copyright © 1995-2003 by The FreeBSD Documentation Project, OpenBSD FAQ Copyright © 1998-2003 OpenBSD, Modified for MicroBSD