Lesson 8 of 29 ↓
- 1.Rhel 9 Administration Guide
- 2.Ubuntu Boot Process Guide
- 3.Linux Basic Commands Guide
- 4.Comprehensive Unix Shells Guide
- 5.Mastering Vim Deep & Practical Guide
- 6.Magic Numbers in Linux Deep Systems Guide
- 7.Wildcards & Globbing in Linux Deep Cli Guide
- 8.Linux Users & Groups Deep Administration Guide
- 9.Journaling in Linux Filesystems Deep Systems Guide
- 10.Getopt & Getoptlong Deep System-level Option Parsing Guide
- 11.Su Command in Linux Complete Guide with Environment Variables
- 12.Linux File Permissions and Ownership Complete Practical Guide
- 13.Ubuntu Package Management Apt Complete Guide
- 14.Bash Scripting Basics
- 15.Linux File System Essentials
- 16.Process and Thread Management
- 17.Session 10 : Introduction to Networking & the Application Layer
- 18.Linux Networking Cli & Introduction to Yocto for Machine Routing
- 19.Comprehensive Guide to Ssh (secure Shell)
- 20.Logical Volume Management (lvm) Guide
- 21.C Build Process & Libraries Guide
- 22.Archiving and Compression in Linux
- 23.Linux Package Managers: a Detailed Guide
- 24.Misra-c Guidelines Detailed Cheat Sheet
- 25.Mqtt Server Setup (pc as Server)
- 26.Detailed Explanation of Tty and Pts in Linux
- 27.Vim Cheat Sheet
- 28.Difference Between apt and apt-get
- 29.Difference Between apt Upgrade and apt Full-upgrade
3 min read
Linux Users & Groups Deep Administration Guide
A production-grade, systems-level guide to Linux users, groups, and identity management. This document does not repeat basic commands only—it explains how Linux models identities internally, how permissions are enforced, how administrators design group strategies, and how everything ties into security, filesystems, and enterprise setups.
Why Users & Groups Exist
Linux is designed as a multi-user, time-sharing operating system.
Goals:
-
Isolate users from each other
-
Prevent accidental or malicious damage
-
Enable controlled collaboration
Everything in Linux runs as a user, even system services.
Identity Model in Linux
Core Identifiers
| Identifier | Meaning |
|---|---|
| UID | User ID |
| GID | Group ID |
| EUID | Effective User ID |
| EGID | Effective Group ID |
Example:
idUIDs are what the kernel actually checks, not usernames.
System vs Normal Users
| Type | UID Range | Purpose |
|---|---|---|
| root | 0 | Superuser |
| System users | 1–999 | Daemons & services |
| Normal users | ≥1000 | Human users |
System users cannot usually log in.
Where Linux Stores User Data
Key Files
| File | Purpose |
|---|---|
/etc/passwd |
User account database |
/etc/shadow |
Encrypted passwords |
/etc/group |
Group memberships |
/etc/gshadow |
Secure group data |
Never edit /etc/shadow manually.
Authentication vs Authorization
| Phase | Meaning |
|---|---|
| Authentication | Who are you? |
| Authorization | What are you allowed to do? |
Linux users & groups control authorization, not authentication mechanisms.
User Management (deep Dive)
Creating Users (low-level)
sudo useradd -m -s /bin/bash aliceKey options:
-
-u→ UID -
-g→ primary group -
-G→ supplementary groups -
-d→ home directory
Passwords:
sudo passwd aliceModifying Users
sudo usermod -s /bin/zsh alice
sudo usermod -aG sudo alice⚠ -G replaces existing groups — always use -aG.
Deleting Users Safely
sudo userdel alice
sudo userdel -r aliceCheck for remaining files:
find / -uid 1001Group Management (deep Dive)
Creating Groups
sudo groupadd developersModifying Groups
sudo gpasswd -a alice developers
sudo gpasswd -d alice developersGroups enable permission abstraction.
Primary vs Supplementary Groups (deep Truth)
Primary Group
-
Exactly one per user
-
Stored in
/etc/passwd -
Default group for new files
Supplementary Groups
-
Multiple allowed
-
Stored in
/etc/group -
Grant additional access
Changing behavior with setgid.
Useradd vs Adduser (truth Table)
| Aspect | useradd | adduser |
|---|---|---|
| Level | Low | High |
| Interactive | ❌ | ✅ |
| Scriptable | ✅ | ⚠ |
| Defaults | Minimal | Human-friendly |
Admins prefer useradd in scripts, adduser on desktops.
Group-based Access Control (patterns)
Pattern 1: Project Group
projectA → groupABenefits:
-
No per-user permissions
-
Easy onboarding/offboarding
Pattern 2: Role-based Groups
sudo, docker, adminsAssign roles instead of permissions.
File Ownership & Permission Resolution
Resolution order:
-
Owner
-
Group
-
Others
Kernel checks IDs, not names.
Example:
ls -l fileSetgid, Umask & Collaboration
Setgid Directory
chmod g+s /sharedEffect:
- New files inherit group
Umask
umask 002Ensures group write access.
Advanced Permission Scenarios
Shared Development Folder
groupadd dev
chown :dev /project
chmod 2775 /projectPrevents permission conflicts.
Auditing & Troubleshooting
Key commands:
id user
groups user
getent passwd
group userFind access failures:
namei -l pathSecurity Best Practices
-
Use groups, not users
-
Avoid root where possible
-
Remove users cleanly
-
Audit group membership regularly
Avoid permission creep.
Enterprise & Server Scenarios
-
LDAP / Active Directory
-
Centralized identity
-
sudo via group policy
Local users become identity clients.
Hands-on Labs
Beginner:
idIntermediate:
mkdir /shared
chmod 2770 /sharedAdvanced:
find / -gid dev✅ This guide is written for Linux administrators, security engineers, DevOps, and embedded Linux developers.
Understanding users and groups means understanding Linux security itself.
Happy administering 🐧🔐
Comments
Loading the discussion…