Linux namespaces

Introduction

A namespace is a wrapper around system resources and part of the Linux kernel. The goal of namespaces is to create an isolated world for a process or processes. These processes can only see those resources within the namespace. Namespaces are an important building block to create containers. In systemd it is used to allow sandboxing of applications, typically increasing the security of the related service.

Types of namespaces

NamespaceShort nameKernel identifierDescription
CgroupcgroupCLONE_NEWCGROUPControl group root directory
IPCipcCLONE_NEWIPCProcess communication, such as System V IPC, POSIX message queues, semaphores
NetworknetCLONE_NEWNETNetwork devices, network stack, ports
MountmntCLONE_NEWNSMount points
PIDpidCLONE_NEWPIDProcess IDs
TimetimeCLONE_NEWTIMEBoot and monotonic clocks
UseruserCLONE_NEWUSERUser and group IDs (like in /etc/passwd)
UTSutsCLONE_NEWUTSHostname of system and NIS domain name

The following tools can be useful to learn more about namespaces, see information, or perform related tasks.

CommandDescription
firejailfirejail sandboxes applications
lsnsShows used namespaces