A Read-Only Root Filesystem is a container or host setting that mounts the root filesystem without write access, so running processes cannot modify system binaries or configuration. It hinders attackers from dropping tools, altering executables or persisting changes after compromise. Applications needing writable space get explicit temporary or volume mounts, which should be limited and monitored.
What a Read-Only Root Filesystem Changes
A read-only root filesystem makes the base operating layer resistant to in-place change. Processes can still run, but they cannot quietly rewrite system files, alter shared libraries, or leave behind durable changes in the root tree. That shifts compromise from “tamper with the host” toward narrower, more visible write paths.
This control is especially useful in containerised workloads and hardened hosts where the application should not need to mutate the operating system. It does not eliminate the need for writable paths, it forces those paths to be deliberate, bounded, and easier to review.
Why It Matters for Containment and Drift
The main value is containment. If an attacker gains code execution, a read-only root filesystem reduces the chance that they can install tools, modify boot or service files, or persist by editing local configuration. It also helps prevent configuration drift caused by application bugs, misguided debugging, or accidental writes into the base image layer.
Used well, it supports immutable-host patterns where the preferred response to change is replacement, not patching live state. That makes the runtime easier to reason about and the post-incident state easier to trust.
For a broader hardening view, the pattern fits naturally with Immutable Infrastructure Security Guide, which covers the operational logic behind no in-place change, rebuild cadence, and forensics on immutable systems.
How Writable Exceptions Should Be Treated
A read-only root filesystem does not mean “nothing can write anywhere.” Applications usually still need temporary space, logs, caches, sockets, or mounted data volumes. The security question is whether those exceptions are explicit, minimal, and separate from the operating system itself.
When write access is granted through mounts or ephemeral paths, those locations become the real trust boundary. If they are too broad, shared across components, or writable by untrusted code, they can undo much of the protection that the read-only root was meant to provide.
That is why host choice matters too. Hardened container-optimised operating systems often pair read-only roots with restricted admin paths, controlled node replacement, and fewer mutable surfaces. See Amazon Linux and Cloud-Optimised Linux Hardening Guide for the surrounding host hardening decisions that make this control more effective.
Where It Sits in Defence-in-Depth
This setting is best understood as a hardening and resilience control, not as a complete compromise barrier. It reduces post-exploitation flexibility, but it does not stop a vulnerable application from being abused, nor does it block an attacker from operating entirely in memory or through approved writable volumes.
Because of that, it works best alongside least privilege, tight mount discipline, immutable images, and explicit rebuild workflows. It is one of the simpler ways to make persistence harder and recovery more predictable.
Where the filesystem itself must remain protected against lower-level tampering, hardware or firmware write protection may be relevant in other layers of the stack; D3-HBWP Hardware-based Write Protection covers that adjacent protection model.
Risk and Threat Considerations
A read-only root filesystem lowers the attacker’s ability to make durable host changes, but it does not remove compromise risk. If writable volumes, temp paths, or mounted secrets are too permissive, the attacker can still stage tools, alter application behaviour, or pivot through whatever remains writable.
Failure mechanism: The control fails when the application is given broad writable exceptions, when runtime paths are misconfigured, or when an attacker can operate entirely through memory, mounted storage, or another mutable layer outside the root filesystem.
Impact: Persistence, tool dropping, and configuration tampering become easier; incident recovery also becomes less trustworthy if the mutable paths are not tightly bounded and monitored.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
CIS Controls v8, NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS-4 — Secure Configuration of Enterprise Assets and Software | Read-only roots are a secure configuration hardening measure for hosts and containers. |
| Recommendation — Enforce secure baseline settings that keep the root filesystem immutable wherever the workload allows. | ||
| NIST SP 800-53 Rev 5 | CM-6 — Configuration Settings | It constrains mutable system state by enforcing approved configuration baselines. |
| SI-7 — Software, Firmware, and Information Integrity | Immutable roots help preserve integrity by making tampering with system files harder. | |
| Recommendation — Set and verify configuration baselines that keep the root filesystem read-only. Use integrity controls to detect unauthorized modification attempts against protected system areas. | ||
| ISO/IEC 27001:2022 | A.8.9 — Configuration management | The control aligns with managing and restricting changes to operational system configuration. |
| Recommendation — Apply configuration management to prevent unauthorized changes to the base filesystem. | ||
| NIST CSF 2.0 | PR.DS-02 — Data in transit is protected | Not applicable |
Practitioner Guidance
Why practitioners should care: Treat the read-only root filesystem as a design decision about which parts of the runtime are allowed to change. If a workload truly needs write access, make that need explicit and review it as part of the workload’s trust model rather than as a convenience default.
What to watch for: Repeated writes to temp directories, unexpected use of host paths, and exceptions that expand over time are signals that the control is becoming porous. A small number of well-defined writable mounts is usually easier to defend than a broad “mostly read-only” exception set.
Practitioner takeaway: The control is strongest when paired with immutable deployment practices, narrow writable mounts, and a habit of replacing compromised instances rather than repairing them in place.
Related resources from NHI Mgmt Group
- Guide: AI Agent Sandboxing and Code Execution Guide
- Why should Kubernetes containers use a read-only root filesystem?
- What do teams get wrong about read-only root filesystems in Kubernetes?
- What breaks when a Kubernetes pod runs as root and mounts /var/log from the host filesystem?
- Should organisations scan /root before running full filesystem discovery?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 26, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org