Linux Curriculum
On this page
Linux Users Overview
Linux is inherently a multi-user, multi-tasking operating system. From its foundational Unix heritage, the Linux kernel enforces strict security boundaries by associating every running process, open file descriptor, network socket, and storage block with an identifiable User Account.
In modern DevOps, cloud infrastructure, and containerization, user management is not simply about human developers logging into shells. It is the primary security boundary that governs:
- Principle of Least Privilege (PoLP): Restricting daemons (Nginx, PostgreSQL, Redis) from operating as root.
- Container Security: Preventing container breakouts by enforcing non-root container runtimes (
USER 1001in Dockerfiles). - Service Isolation: Ensuring a compromised web application cannot read database configuration files or mutate system binaries.
1. The Three Categories of Linux Users
Every user account on a Linux system falls into one of three distinct categories:
A. The Superuser (root, UID 0)
- Has the numerical User ID (UID) of
0. - The Linux kernel bypasses standard discretionary access control (DAC) permission checks for UID 0. Root can read, modify, or delete any file, bind to privileged network ports (< 1024), install kernel modules, and manage hardware devices.
- In modern security best practices, direct interactive root login over SSH is strictly disabled (
PermitRootLogin no), and administrative tasks are delegated viasudo.
B. System (Service) Users (UID 1 to 999)
- Accounts created automatically by package managers to run system services and background daemons (e.g.,
www-data,nginx,postgres,systemd-resolve,docker). - These accounts do not represent real human beings.
- Security Design:
- They have no valid login shell (set to
/usr/sbin/nologinor/bin/false). - They have locked passwords (cannot authenticate via SSH or console).
- If a service (like Apache or Node.js) is compromised via remote code execution, the attacker's shell is trapped with limited system user permissions.
- They have no valid login shell (set to
C. Regular (Interactive) Users (UID 1000+)
- Accounts created for human operators, engineers, and automated CI/CD deployment agents (e.g.,
ubuntu,deploy,jenkins). - Assigned personal home directories under
/home/<username>. - Assigned an interactive login shell (typically
/bin/bashor/bin/zsh).
2. User Identifiers: The UID Range Mapping
The Linux kernel does not recognize strings like "ubuntu" or "nginx" internally. It operates strictly on numerical integers called User Identifiers (UIDs).
The allocation ranges are governed by /etc/login.defs:
3. Real-World DevOps Context: Container Security & Rootless
In Docker and Kubernetes, a common vulnerability is running containers as root (UID 0 inside the container):
The DevOps Fix: Enforce Dedicated Non-Root Users
In production Dockerfiles, always define and switch to a non-root system user:
Summary
- The Linux kernel strictly identifies users by numerical User Identifiers (UIDs).
- UID 0 (
root) possesses unrestricted kernel capabilities. - System users (UID 1–999) run background daemons with disabled login shells (
/usr/sbin/nologin). - Regular human users occupy UID 1000 and higher.
- In cloud and container operations, enforcing non-root UIDs is the foundation of container workload security.