Skip to main content
Module 7 · Lesson 2 of 425/42 in the course~15 min
Module lessons (2/4)

Locking .env, SSH Keys & World-Writable Files

Lesson preview6 hands-on exercises readyApplication & Web Security · Module 7 — Linux Server Hardening & Forensics

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 .env credential files (600).
  • Restore legitimate owner/group assignments with chown and 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

  1. 11. Unix Octal Modes & Least-Privilege Ownership
  2. 22. Interactive Explorer: Unix Permission Bits Calculator
  3. 33. Progressive Labs: Warm-Up → Attack → Defend → Harden
  4. 44. Checkpoints & Code Review
Pro Lesson · Module 7 — Linux Server Hardening & Forensics

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.