← Home ← Codex ← DEBT ← Engine
Browse by Category
+ added · updated 7d
← Back to glossary

Linux User & Group Management

Linux Intermediate
debt(d5/e5/b7/t7)
d5 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'specialist tool catches it' (d5). The detection_hints list lynis (security auditing tool), ansible (configuration management that can enforce state), and semgrep (SAST). These are specialist tools — not default linters or compilers — that catch patterns like PHP-FPM running as root or shared credentials. A basic code review may miss misconfigurations living in server config files rather than application code.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix involves creating a dedicated deploy user, reconfiguring PHP-FPM pool settings, adjusting file ownership across the web root, and configuring sudo with specific commands. This spans multiple configuration files (PHP-FPM pool config, /etc/sudoers, file system ownership) and requires coordinated changes across deployment scripts and server config — more than a one-line patch but not full architectural rework.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (e7). User and permission decisions apply to both web and CLI contexts and shape every deployment, file operation, and process execution on the server. Getting this wrong (e.g., sharing www-data across apps, no deploy/web user separation) imposes ongoing risk and operational cost — every new application, deployment pipeline change, or PHP-FPM pool addition must account for the privilege model already established. It's a load-bearing choice across the system.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7). The misconception field explicitly states that developers believe running PHP-FPM as root is fine for development, when in fact it hands root access to any attacker who exploits a PHP vulnerability. This contradicts developer intuition (root = convenience, not danger) and the common mistakes list shows multiple compounding errors: files owned by www-data, no user separation, shared www-data across apps. These are all traps that a competent developer unfamiliar with Linux privilege models would easily fall into, making this a serious cognitive hazard.

About DEBT scoring →

Also Known As

useradd usermod www-data service account sudo

TL;DR

Managing users and groups on Linux servers — useradd, usermod, passwd, groups — and best practices for PHP web server user isolation and privilege separation.

Explanation

Key commands: useradd (create user), usermod (modify user), userdel (delete user), passwd (set password), groups (show user groups), id (show UID/GID), chown (change file ownership), su/sudo (switch user). PHP web security: PHP-FPM pool runs as www-data (or php-fpm); files should be owned by the deploy user, readable by www-data; writable directories (uploads, cache) owned by www-data. Service accounts: always run services as dedicated users with no login shell (/sbin/nologin) and no home directory unless needed. Principle of least privilege: each service user has only the access it needs.

Common Misconception

Running PHP-FPM as root is fine for development — running as root means a PHP vulnerability gives attackers root access to the server; always run PHP-FPM as a dedicated low-privilege user.

Why It Matters

PHP code execution vulnerabilities on a server running PHP as root give full server compromise — the same vulnerability on a www-data user is limited to that user's permissions.

Common Mistakes

  • PHP-FPM running as root — critical security vulnerability.
  • Web files owned by www-data — means a PHP exploit can modify the codebase; own files by deploy user.
  • No separation between web user and deploy user — deploy credentials compromise the web process.
  • Sharing www-data between multiple applications — one compromised app can read another's files.

Code Examples

✗ Vulnerable
# PHP-FPM as root — never do this:
[www]
user  = root
group = root

# World-writable files — any process can modify:
chmod 777 /var/www/html/uploads/
# Any user on the system can write here
✓ Fixed
# PHP-FPM pool — dedicated low-privilege user:
[www]
user  = www-data
group = www-data

# File ownership separation:
# Application files: deploy user owns, www-data reads
chown -R deploy:www-data /var/www/app/
find /var/www/app -type f -exec chmod 640 {} \;
find /var/www/app -type d -exec chmod 750 {} \;

# Upload dir: www-data writes only here:
chown www-data:www-data /var/www/app/storage/
chmod 750 /var/www/app/storage/

# Create service account with no login shell:
useradd --system --no-create-home --shell /sbin/nologin php-worker

Added 16 Mar 2026
Edited 22 Mar 2026
Views 81
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 1 ping W 0 pings T 0 pings F 1 ping S 2 pings S 4 pings M 0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 1 ping M 1 ping T 0 pings W
No pings yet today
SEMrush 1
Amazonbot 10 Scrapy 7 SEMrush 6 Ahrefs 5 Perplexity 4 Bing 4 PetalBot 4 Unknown AI 3 Google 3 ChatGPT 3 Twitter/X 2 Majestic 1 Applebot 1
crawler 51 crawler_json 1 pre-tracking 1
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: Medium
⚡ Quick Fix
Run PHP-FPM as www-data (uid 33), never as root; create a dedicated deploy user with minimal permissions for deployments; use sudo with specific commands instead of full root access
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
PHP-FPM running as root; SSH access with root password; shared deploy credentials; no separation between web user and application user
Auto-detectable: ✓ Yes lynis ansible semgrep
⚠ Related Problems
🤖 AI Agent
Confidence: High False Positives: Medium ✗ Manual fix Fix: Medium Context: File
CWE-250 CWE-272


✓ schema.org compliant