Q: A developer accidentally ran `chmod -R 777 /var/www/html` and now the web server is throwing 500 errors. How do you recover?
777 permissions mean anyone can read, write, and execute the files. Many modern web applications, PHP-FPM, or SSH instances will refuse t...
#Linux #Linux / SRE — Scenario-Based Interview Questions #L2 #SRE #Systems #Troubleshooting
🎙️ Candidate Opening & Architectural Context
""We encountered this OS-level bottleneck during peak traffic and diagnosed it down to kernel and filesystem metrics. The interviewer is testing: File permissions, understanding of web server security context.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
777 permissions mean anyone can read, write, and execute the files. Many modern web applications, PHP-FPM, or SSH instances will refuse to read configurations or execute scripts if they are globally writable, citing security risks.
find /var/www/html -type d -exec chmod 755 {} \;find /var/www/html -type f -exec chmod 644 {} \;
2️⃣
Remediation & Permanent Safeguards
To fix this, we need to revert to standard secure permissions: Directories should typically be 755 and files should be 644. I would run: Then, I'd ensure the ownership is correct (e.g., owned by nginx:nginx or www-data:www-data): chown -R www-data:www-data /var/www/html. This restores standard secure execution parameters.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: find /var/www/html -type d -exec chmod 755 {} \;."
⚡ 60-Second Elevator Pitch Talking Points
- find /var/www/html -type d -exec chmod 755 {} \;
- find /var/www/html -type f -exec chmod 644 {} \;
Advertisement