Master Linux Users and Groups: Permissions, Files, and Management Commands
Learn the essential concepts of Linux user and group management, including user types, the structure of /etc/passwd and /etc/shadow, group definitions, permission inheritance, and practical commands such as useradd, usermod, groupadd, and userdel for creating, modifying, and deleting accounts.
1. Users
A user is a collection of permissions to access system resources.
Linux user categories
a. Administrator (root): has all system permissions, UID 0.
b. Regular user: limited permissions, UID 500‑60000.
c. System user: for system operation, no password login, UID 1‑499.
Files related to users
/etc/passwd
Format: account:password:UID:GID:GECOS:directory:shell
account – username
password – placeholder
UID – user ID
GID – primary group ID
GECOS – detailed info (name, age, phone, etc.)
directory – home directory
shell – login shell
/etc/shadow
Format: account:password:last_change:min:max:warn:inactive:expire:reserved
4. User groups
Group categories:
Regular group: multiple users can join.
System group: typically contains system users.
Private (primary) group: created with a user if no group specified; name matches username; can become regular group when other users are added.
5. Groups as permission containers
Users inherit permissions of the groups they belong to.
6. Files related to groups
/etc/group
Format: group_name:password:GID:user_list
group_name – name of the group
password – group password
GID – group ID
user_list – list of users belonging to the group
7. Commands to manage users and groups
useradd, usermod, groupadd, userdel
Add user
useradd [options] usernameOptions:
-u UID
-g GID
-d home_directory (default /home/username)
-s shell
-G supplementary_groups
Example:
# useradd -u 1888 -d /home/oracle -s /bin/sh wendyModify user
usermod [options] usernameOptions similar to useradd; -m with -b moves home directory contents.
Example:
# usermod -u 1000 -d /oracle -s /bin/bash -m wendyAdd group
groupadd [options] groupnameOption:
-g GID
Example:
# groupadd -g 1001 grpDelete user
userdel [options] usernameOption:
-r remove home directory
Example:
# userdel -r wendySigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
