Module lessons (2/4)
Locking .env, SSH Keys & World-Writable Files
Audit permissive 0777 and 0644 secret files, restore proper ownership with chown, and restrict keys cleanly with chmod 600.
What you'll learn in this lesson
- Interpret Unix octal permission masks (
600,640,750,755,777) and owner/group boundaries on shared hosts. - Eliminate world-readable private SSH keys (
id_rsa) and world-writable.envcredential files (600). - Restore legitimate owner/group assignments with
chownand verify least-privilege directory isolation.
Overview
If an attacker achieves even minimal local read access — for instance through a compromised background plugin, shared CI runner, or local SSRF file read — 0644 and 0777 secret files let unrelated system users or compromised daemons steal database credentials and overwrite config files.
Inspect four common hardening actions on multi-user Linux hosts:
Sections covered in this lesson
- 11. Unix Octal Modes & Least-Privilege Ownership
- 22. Interactive Explorer: Unix Permission Bits Calculator
- 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
- 44. Checkpoints & Code Review
Unlock "Locking .env, SSH Keys & World-Writable Files" and the full Application & Web Security curriculum
Audit permissive 0777 and 0644 secret files, restore proper ownership with chown, and restrict keys cleanly with chmod 600.
Unlock all 6 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Application & Web Security plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.