Principle of Least Privilege in OS Hardening
What you'll learn: How to minimize permissions at the operating system level to reduce the damage an attacker or compromised component can cause.
The Core Idea
The Principle of Least Privilege in OS hardening means granting users, processes, and system components only the absolute minimum permissions they need to perform their intended functions—nothing more. This is the same principle you've already seen applied to secrets management (Lesson 1313), but now applied broadly across the entire operating system layer.
Think of it like giving a delivery driver the key to your building's lobby, but not the master key that opens every apartment. If that key is stolen or misused, the damage is contained.
Why It Matters for OS Security
When an attacker compromises a user account or exploits a vulnerable process, they inherit whatever permissions that entity has. By limiting those permissions from the start, you create containment boundaries that prevent lateral movement and privilege escalation. A web server process running as root can do anything; one running as a dedicated, unprivileged user with read-only access to its web files is far less dangerous when compromised.
Practical Applications
- User accounts: Regular users shouldn't have administrative privileges for daily tasks
- Service accounts: Database services, web servers, and applications should run under dedicated accounts with minimal file system and network permissions
- File permissions: Config files should be readable only by the services that need them; executables shouldn't be world-writable
- Network access: Processes should only bind to necessary ports and communicate with required endpoints
This defense-in-depth approach reduces your attack surface (Lesson 1404) by shrinking the blast radius of any single compromise.
Key Takeaway: Least privilege at the OS level means every user, process, and component operates with the minimum permissions necessary—limiting damage when (not if) something gets compromised.