The users of a system are defined in the file /etc/passwd. Each line of this file contains the name of a user, the user's encrypted password (or an x if the encrypted password is stored elsewhere), the user id number and group id number, and other information such as the user's real name and home directory.
The groups of a system are defined in the file /etc/group. Each line of this file contains the name of a group, the group id number, and optionally a list of users belonging to the group. A user can belong to more than one group. The user's primary group is the one specified in /etc/password, and any other groups the user belongs to are specified by listing the user in /etc/group.