February 2006
Intermediate to advanced
648 pages
14h 53m
English
The grp module provides access to the UNIX group database.
getgrgid(gid)Returns the group database entry for a group ID, gid. The returned object is a group structure with the following attributes:
gr_name—The group name
gr_passwd—The group password (if any)
gr_gid—The integer group ID
gr_mem—A list of usernames in the group
The returned object also behaves like a 4-tuple (gr_name, gr_passwd, gr_gid, gr_mem). Raises KeyError if the group doesn’t exist.
getgrnam(name)Same as getgrgid(), but looks up a group by name.
getgrall()Returns all available group entries as a list of tuples as returned by getgrgid().
See Also
pwd (p. 332)