Quiz Entry - updated: 2026.07.14
What is the root user and why should you avoid logging in as root?
Root is UID 0, the superuser the kernel exempts from every permission check; you avoid logging in as root because one mistake (or one compromised command) then has unlimited, unlogged reach.
The deeper reason is the principle of least privilege: you want to operate with only the rights the task needs, and borrow root briefly via sudo for the one command that needs it. That keeps a typo like rm -rf scoped, leaves an audit trail of who did what, and shrinks the window an attacker has to abuse full power.
Root can:
- Read, modify, delete ANY file
- Change ANY system setting
- Kill ANY process
- Bypass ALL permission checks
Why NOT to use root directly:
| Risk | Consequence |
|---|---|
| No safety net | Mistakes affect entire system |
| No audit trail | Hard to track who did what |
| Security risk | Attackers target root accounts |
| Accident prone | Typos can be catastrophic |
Better approach - use sudo:
# Bad: logged in as root
rm -rf /important/
# Good: use sudo for specific commands
sudo rm -rf /important/ # Requires password, gets logged
Linux vs Windows:
- Linux: root login typically disabled, use
sudo - Windows: Admin accounts common, UAC prompts
Tip: Only use root when absolutely necessary, and prefer sudo for individual commands.