What does a user account do?
A user account associates a textual user name with a numeric user ID and group ID, a login password, a user's full name, a home directory, and a login shell. This data is stored in the /etc/passwd and /etc/shadow files, where it's accessed by login utilities as well as by other applications that need user-account information.
User accounts let:
- users log in with a user name and password, starting a session under their user ID and group ID
- users create their own login environments
- applications determine the user name and account information relating to a user ID and group ID if they're defined in /etc/passwd and /etc/group (e.g., ls -l displays the names—not the IDs—of the user and group who own each file)
- utilities and applications accept user names as input as an alternative to numeric user IDs
- shells expand ~username paths into actual pathnames, based on users' home directory information stored in their accounts
Groups are used to convey similar permissions to groups of users on the system. Entries in /etc/passwd and /etc/group define group membership, while the group ID of a running program and the group ownership and permission settings of individual files and directories determine the file permission granted to a group member.
When you log in, you're in the group specified in /etc/passwd. You can switch to another of your groups by using the newgrp utility.