Skip to main content
On a Linux system, every process, file, and service runs under a user account. Proper user and group management is the foundation of system security: it controls who can log in, what they can access, and what they are allowed to do. In this guide you’ll learn how to create users, modify accounts, manage passwords, and control group membership. These are core skills for any system administrator or anyone responsible for Linux security. We’ll cover:
  • Linux users and groups (the foundation of access control)
  • Superuser access (the power and risks of root)
  • Managing user accounts (create, modify, remove)
  • Group management (organizing permissions efficiently)
  • Password management and policies
A dark-themed slide titled "Overview" with bullet points about Linux user and group management. It lists topics like understanding users/groups, superuser/root privileges, creating and removing accounts, group management, and password policies.

Concepts: users, groups, UIDs and GIDs

Before creating or modifying accounts, understand how Linux models identities and permissions. Think of a Linux system like a company building:
  • Each person is a user account.
  • Groups are teams or departments.
  • Files and directories are offices or storage rooms.
  • Permissions determine which teams can enter which rooms.
This analogy helps when assigning ownership and access controls.
An infographic titled "Linux Users and Groups" shows the Linux penguin (Tux) labeled "Linux System" at the top with arrows down to a "Company Building" containing icons for users, teams/departments, and offices/storage rooms. It illustrates how a Linux system manages users and groups across an organization's resources.

What is a user? UIDs and user types

A user is an entity that can manipulate files and run processes. The kernel tracks users by numeric IDs because numbers are faster and more consistent than names.
  • The privileged administrative user is root and always has UID 0.
  • Normal user UIDs typically start at 1000 on many modern distributions (including Red Hat Enterprise Linux).
  • System accounts (daemons, service users) use lower-numbered UIDs reserved for the OS.
A slide titled "User Types" showing a Linux operating system diagram with a central "User" icon labeled "Unique ID (UID)". The user is connected to an "Entity" on the left and a box on the right that says "Manipulate files and perform other operations."
The root account can perform any action, including destructive ones. Use sudo and least-privilege principles to reduce the risk of accidental or malicious changes.

Groups and GIDs

Groups aggregate users for easier permission management. Each group has a numeric Group ID (GID). Users have:
  • a primary group (GID recorded in /etc/passwd), and
  • zero or more supplementary (secondary) groups listed in /etc/group.
On many RHEL-family systems, creating a user also creates a group with the same name (the “user private group” scheme).
A dark-themed slide titled "Groups" explaining Linux groups with a central group icon connected to "Normal users" and "Multiple groups exist for special roles/tasks." Below the icon is a label for "Group ID (GID)."

Where user and group data are stored

Important files:
  • /etc/passwd — basic account information (login name, UID, GID, home, shell). The password field usually contains x when shadowing is enabled.
  • /etc/shadow — stores password hashes and password-aging fields; readable only by root.
  • /etc/group — group names and membership.
  • Configuration defaults for account creation and password policy are in files like /etc/login.defs and distribution-specific files such as /etc/default/useradd.
A diagram of Linux Users and Groups showing User, Password, and Group information stored in /etc/passwd, /etc/shadow, and /etc/group. It also maps management commands (useradd, usermod, userdel, chage, groupadd, groupmod, groupdel) to create, alter, and delete actions.
Keep /etc/shadow readable only by root. If its permissions are relaxed, password hashes may be exposed, creating a significant security risk.
Why this matters: authentication and permissions rely on accurate UID and GID values. Incorrect entries or file corruption can prevent logins or expose accounts to unauthorized access.

Common administration commands

Use these tools to create, modify, and remove users and groups, and to manage password aging. Refer to the manual pages for details: man useradd, man usermod, man userdel.

Understanding /etc/passwd and /etc/shadow

When a user is created, the system updates /etc/passwd and /etc/shadow. Example /etc/passwd line:
Fields in /etc/passwd (colon-separated):
  1. Login name
  2. Password placeholder (x when using shadowing)
  3. UID
  4. GID (primary group ID)
  5. Comment (GECOS) field — often full name or description
  6. Home directory
  7. Default shell
Example /etc/shadow line:
Fields in /etc/shadow (colon-separated):
  1. Login name
  2. Encrypted password hash (or special values such as ! or * to lock the account)
  3. Last password change (days since epoch)
  4. Minimum days between password changes
  5. Maximum days the password is valid
  6. Warning period (days before expiry to warn the user)
  7. Inactivity period (days after password expiration until the account is disabled)
  8. Account expiration date (days since epoch) or empty
  9. Reserved (unused)
Mistakes in these files (for example incomplete entries or incorrect UID/GID mappings) can break authentication or cause privilege issues.

User shell startup files and the environment

When a user logs in, shell startup files set aliases, environment variables, PATH, and startup commands. For Bash:
  • ~/.bash_profile — executed for login shells; sets session-level environment variables and typically sources ~/.bashrc.
  • ~/.bashrc — executed for interactive non-login shells; used for aliases, functions, and per-shell settings.
  • ~/.profile — fallback for login shells if ~/.bash_profile and ~/.bash_login are absent.
  • System-wide settings are typically in /etc/profile and /etc/profile.d/* and are processed before user-level files.
This separation keeps session-wide configurations distinct from shell-specific tweaks.

Next steps

Now that you understand the data model (UIDs/GIDs), where account information is stored, and the standard administrative commands, you can begin creating and managing users and groups safely. Links and references

Watch Video