Re: Groupd and User's Group Changing

Cameron Simpson <[email protected]> Sat, 15 Mar 2003 21:38:00 +1100
Newsgroups gmane.linux.redhat.release.seawolf
Message-ID <[email protected]>
On 11:26 14 Mar 2003, Nestor Waldyd <[email protected]> wrote:
| I really don't have a good definition of what a group is in Linux... Would you please give me one? What i know 
| is that a group is a set of users, but how can i change an user's group?

A group is a set of users, but the sets need not be disjoint.  A user may
be a member of several groups for access to various things.

The mapping is mostly in the file /etc/group, whihc is a list of group
names, group ids (the internal numeric values used to represent each
group) and the users in each.

At any given time a process has
	- a user id (uid)
	- a primary group id
	- a list of secondary groups ids

The uid and primary gid come from the /etc/passwd file.
The secondary gids come from the /etc/group file.

There's nothing special about the primary versus secondary gids; the
primary gid dates from an early revision of UNIX where there was only the
primary gid and no secondaries; the eatra groups were a BSD innovation,
now universal.

When accessing a file exactly _one_ of the three permission groups on the
file are considered:

	- if the user id of the file matches the user id of file
	  then the first (user) set of permissions are used

	- otherwise, if the gid of the file matches one of the gids of the
	  process, the second set is used

	- otherwise, the third ("other") set is used

Cheers,
-- 
Cameron Simpson, DoD#743        [email protected]    http://www.zip.com.au/~cs/

Success in software development depends on making a carefully planned
series of small mistakes in order to avoid making unplanned large
mistakes.	- Steve McConnell, _Software Project Survival Guide_