Join our Newsletter — 33% off our NHI Course
Home Glossary Cyber Security Read-Only Filesystem
Cyber Security

Read-Only Filesystem

← Back to Glossary
By NHI Mgmt Group Updated September 19, 2026 Domain: Cyber Security

A container setting that prevents processes from writing to the runtime filesystem. It helps stop attackers from altering the environment after compromise, which limits tampering, persistence, and some forms of data collection or destructive activity. Applications that need writes must use separate writable mounts or storage paths.

How a Read-Only Filesystem Changes Container Behaviour

A read-only filesystem makes the container runtime filesystem immutable for normal process writes. That changes the default assumption from “applications can alter their own local state” to “writes are blocked unless they are explicitly redirected somewhere else.”

Operationally, that matters because many container compromises begin with an attacker trying to drop tools, modify scripts, patch startup files, or alter configuration on disk. If the filesystem is read-only, those changes fail unless the attacker can reach a separate writable path.

The control is strongest when the application is designed for it, with logs, cache, uploads, temp files, and database state moved to separate writable mounts. If the application still expects to write into its package directories, a read-only filesystem will surface those assumptions quickly during testing rather than after deployment.

What It Protects, and What It Does Not

The main security value is post-compromise containment. If an attacker gets code execution inside the container, read-only root storage can make it harder to persist changes, tamper with binaries, backdoor entrypoints, or quietly stage destructive actions on the base image layer.

It also narrows the blast radius of accidental writes, buggy self-modifying code, and transient application errors. That can improve integrity and reduce operational drift, especially in ephemeral workloads that should be recreated rather than edited in place.

It does not remove the need for least privilege, secret handling, or network controls. An attacker may still read data, call internal services, or abuse mounted writable volumes. For that reason, the control should be treated as one containment layer, not a standalone hardening strategy. For a broader view of how container hardening fits into secure configuration practice, see CIS Benchmarks.

Common Implementation Patterns and Trade-offs

Most teams combine a read-only root filesystem with explicit writable mounts for the few paths that truly need them. Typical examples are temporary working directories, application caches, upload locations, and log paths that a sidecar or runtime agent collects.

The trade-off is that usability and security now depend on clean path separation. If the image or application assumes it can update itself, install packages, write PID files, or mutate configuration in place, those behaviours must be refactored or redirected. That often reveals hidden coupling between the application and the container image.

When the workload is expected to be immutable, the pattern aligns well with secure deployment discipline and image integrity goals. For teams that also care about build and release integrity, SLSA is a useful companion reference for the provenance side of the same trust problem.

Why It Matters for Hardened Runtime Environments

A read-only filesystem is most valuable in systems where runtime changes are unnecessary and suspicious. That includes stateless services, short-lived jobs, and containers that should be recreated from a trusted image rather than repaired in place.

It also supports a stronger containment posture when paired with other runtime restrictions such as dropping unnecessary capabilities, limiting mounted volumes, and keeping secrets out of the writable filesystem. In that sense, it is a practical anti-tampering measure that helps preserve the expected state of the container during its lifetime.

For container teams looking to understand the broader runtime and identity implications of secrets, mounts, and exposed execution paths, Ultimate Guide to NHIs provides a useful adjacent reference on why compromised runtime material is often so damaging.

Risk and Threat Considerations

Read-only filesystems reduce, but do not eliminate, post-compromise abuse. The remaining risk is that attackers can still operate through writable mounts, memory, network access, and any secrets or tokens already present in the container.

Failure mechanism: If a workload still has a writable path, an attacker can use it for persistence, tool staging, log tampering, or data exfiltration even when the root filesystem itself is immutable.

Impact: The control may slow or constrain attacker activity, but it will not stop compromise from spreading if the workload also has excess privileges, exposed credentials, or broad network reach.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS 4 — Secure Configuration of Enterprise Assets and SoftwareRead-only root filesystems are a secure configuration hardening measure for container runtime paths.
CIS 3 — Data ProtectionWritable paths and mounted storage affect where sensitive data can be exposed or altered at runtime.
Recommendation — Enforce read-only container filesystems and allow writes only on explicitly approved mounts. Restrict sensitive data to approved storage locations and avoid writing secrets to the container filesystem.
NIST CSF 2.0PR.IP — Information Protection Processes and ProceduresImmutable runtime storage supports controlled, repeatable protection procedures for deployed workloads.
PR.AC — Identity Management, Authentication and Access ControlFilesystem immutability complements access control by limiting what a compromised process can change.
Recommendation — Standardize immutable container settings and document approved writable paths. Pair read-only runtimes with least-privilege access and tightly scoped mounts.

Practitioner Guidance

What to watch for: Treat this setting as effective only when the application genuinely does not need to write to its base filesystem. If deployments fail because of hidden write dependencies, that is usually a sign the container image needs path cleanup, not a reason to weaken the control.

Governance implication: Teams should define which paths are intentionally writable and review them as part of deployment hardening. Unplanned write locations deserve the same attention as any other escape hatch because they can undermine the integrity benefit of the setting.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 19, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org