Skip to content
Lab 1 of 3

Files, Permissions & Ownership

A web app's directory tree is in a broken, insecure state. Take ownership, fix permission modes, set up a shared team directory, and hunt down a leaked secret.
  • Beginner
  • 45 min
  • Linux
  • Permissions
  • Security
  • Sysadmin

Overview

You've inherited a web application whose files are a mess: the service account can't write its own logs, a config file is locked so tightly that nobody can read it — not even the app — and a world-writable upload directory has already been used to plant a fake private key.

UNIX permissions are the oldest and most reliable access-control system on the planet, and the source of a huge share of real production incidents. In this lab you'll repair ownership and modes the way an SRE does on a live box: read the current state with stat, reason about who actually needs what, and apply the least privilege that still works. Along the way you'll meet the setgid bit — the trick behind every shared team directory — and close a genuine security hole.

What you will learn

  • Read and interpret ownership and permission bits with ls -l and stat
  • Reassign owner and group with chown / chgrp, including recursive -R
  • Translate access requirements into precise octal modes like 640 and 750
  • Configure a setgid (2775) directory so new files inherit the team group
  • Find and remediate a world-writable file before it's abused

Before you start

  • You can move around a Linux shell (cd, ls, cat)
  • You know how to run a command with sudo
  • No prior permissions knowledge needed — we build it up from scratch

Tasks

  1. 01Survey the damage and create a releases directory
  2. 02Give the service account its log directory
  3. 03Repair the config file
  4. 04Build a shared team directory with setgid
  5. 05Hunt down and remove the leaked secret
  6. 06Lock down the uploads directory

Next in this course