What Is a Linux Namespace?

One Linux server divided into separate isolated views of system resources

Linux Namespace Explainer

A Linux namespace gives a process and its descendants an isolated view of a particular class of system resource. Processes in different namespaces can use identifiers or configurations that appear independent even though they run on the same kernel. One namespace can provide its own process-ID tree, another its own mount points, and another its own network interfaces and routing tables. Container runtimes combine several namespace types with other controls to create environments that resemble separate systems without starting a separate kernel for each one.

Each namespace type isolates something specific. A PID namespace gives processes a separate numbering view, including an init-like process at PID 1 within that namespace. A mount namespace provides an independent set of mounted file systems and propagation rules. A network namespace has its own interfaces, addresses, routes, firewall state, and port space. UTS namespaces isolate hostname and domain name, IPC namespaces separate certain interprocess-communication objects, and time namespaces can provide differing views of selected clocks.

User namespaces map user and group IDs inside the namespace to different IDs outside it. A process can appear to be root within its user namespace while mapping to an unprivileged host identity. This enables some container operations without granting full host authority, but the mapping and allowed operations are carefully constrained. Capabilities are evaluated in relation to the relevant user namespace, and access to a resource may still depend on ownership and checks in an ancestor or initial namespace.

Namespaces are created or joined through system calls and exposed through process metadata. A process can create a child in new namespaces, unshare selected resources from its current context, or enter an existing namespace when permissions allow. Namespace objects persist while processes or open references keep them alive. Parent-child relationships exist for some types, and a process’s membership cannot always be changed arbitrarily after threads or resources have been created. Runtimes manage these details before launching the application.

Isolation requires connections when workloads need to communicate. A virtual Ethernet pair can link a container’s network namespace to a host bridge, while mount setup presents an intended root file system and hides other paths. Passing file descriptors can deliberately share access across boundaries. These controlled links are features, not failures: a useful isolated process still needs selected storage, networking, and services. The security question is whether those links expose only what policy intended.

A namespace is not a virtual machine and not a complete sandbox. All namespaces rely on the same kernel, so a kernel vulnerability can cross the boundary. Devices, system calls, files, capabilities, cgroup limits, and mandatory access controls need separate configuration. Misconfigured mounts or privileged containers can expose the host even when several namespace types are active. Operators should minimize capabilities, restrict system calls and devices, apply resource controls, and keep the kernel updated. Namespaces provide the visibility layer of container isolation: they let one set of processes see its own coherent IDs and system-resource views while the host kernel maintains the real shared machinery underneath.

Process inspection depends on viewpoint. A host administrator can see the container’s processes with host PIDs, while a process inside sees namespace-local numbers and may be unable to observe host peers. Network tools inside show only that namespace’s interfaces and routes. Mount paths can likewise differ even though the same underlying storage object is shared. These are not contradictory readings; they are names resolved through different namespace memberships. Troubleshooting tools must record both the host context and the target namespace or commands can appear to disagree about the same workload.

Audit records should capture namespace identifiers as well as local process numbers so events can be correlated after short-lived containers exit.

A Linux namespace gives processes an isolated view of one resource class. Key terms include PID namespace, mount namespace, network namespace, UTS, IPC, user namespace, time namespace, mapping, capability, unshare, setns, and container.

Yes. A user namespace can map an inside user ID of zero to an unprivileged host ID. That process has namespace-scoped capabilities, not automatic authority over the host’s initial user namespace.

Namespaces change what processes see but do not inherently limit how much CPU, memory, or I/O they consume. Cgroups provide resource accounting and controls, so container systems commonly use both mechanisms together.

Explore more "Explainers"

Discover additional explainers across politics, science, business, technology, and other fields. Each explainer breaks down a complex idea into clear, everyday language—helping you better understand how major concepts, systems, and debates shape the world around us.