Case study
Replaced a fragile world-writable permissions hack (which had silently broken automated deploys across a fleet for over a year) with a self-healing POSIX-ACL model, piloting on one app to prove the mechanism before migrating the fleet, and shipping a daily detector for the exact failure the existing monitors were blind to.
A development server runs a couple dozen web apps, each auto-deployed by a self-hosted CI runner (a dedicated deploy/runner user) that does git fetch && git reset --hard inside each app directory. The apps were owned by a regular user, but the runner needs to write .git during deploy. The historical fix was a recursive chmod granting world-write (o+w) across the whole app tree.
That fix was structurally unstable: new files inherit the creator's umask, which strips the world-write bit, so any file added after the chmod silently drifted back to non-writable, and the next deploy failed or hung. This bug class recurred for over a year across many apps. Its worst incarnation: one app sat silently frozen at an old commit for weeks (its CI job hung for minutes on the un-writable .git, blocking the single-slot runner) and no monitor caught it, because the uptime monitor sees liveness, not deploy freshness. An early audit found several more apps in the same latent state; their next push would have hung identically.
The real fix had been tracked but repeatedly deferred as "too big to do at once."
The core insight: reach for the right OS primitive. chmod's "other" class can't be scoped to one user and doesn't propagate to new files, while chown transfers ownership away from an app's own service user. POSIX ACLs solve both problems. They are additive (the owner keeps full access; the runner gets an explicit grant) and support a default ACL that new files inherit automatically:
`` setfacl -R -m u:runner:rwX <app> # immediate grant, scoped to the runner setfacl -R -d -m u:runner:rwX <app> # default ACL → new files inherit find … -exec chmod o-w {} + # drop the world-write crutch ``
The capital X is deliberate: it sets the execute bit only on directories, never flagging regular files executable, which would break git's mode tracking, a documented failure of naive chmod 777.
o+w and confirming a real deploy still works..env, heartbeats, caches) must use ACLs, never chown -R runner.fetch + reset --hard touches (made ACL-aware), plus a deploy-freshness check comparing each app's running health-endpoint commit SHA against its checked-out SHA, catching the "pulled but didn't restart" class the uptime monitor can't see.o+w, was granting access. A second app verified live, deploying through the ACL. This is the difference between proving the mechanism and merely proving the outcome; with two overlapping grants you otherwise can't tell which one is load-bearing.chown -R runner to one app broke its background service twice: first it couldn't read its .env (mode 600, owner-only), then, after chowning that back, it couldn't write its heartbeat file. Root cause: chown transferred ownership away from the service user. Fixed properly with restore-ownership + setfacl: direct empirical proof of exactly the failure ACLs are designed to avoid.chown -R a directory whose service writes runtime files in it: the double-broken service is the textbook proof.A companion piece covers the earlier interim fix and the discovery of the silent deploy freeze that surfaced this work.