Photo by Eric Er on Unsplash

On this page

This chapter follows Users, groups and permissions in Linux.

Traditional Unix security is discretionary: file owners choose permissions. Modern Linux adds mandatory layers and fine-grained privilege so services and containers run with less than root. Docker and Kubernetes rely on the same primitives—see Docker overview—without replacing host hardening on Debian itself.

Capabilities instead of full root

Capabilities split superuser powers (CAP_NET_BIND_SERVICE, CAP_SYS_ADMIN, …). setcap grants them to binaries; containers drop caps by default.

Terminal window
getcap -r /usr/bin 2>/dev/null | head

Binding port 80 as non-root can use CAP_NET_BIND_SERVICE instead of setuid root. Audit caps after custom packages—unexpected CAP_SYS_PTRACE widens attack surface.

Namespaces for isolation views

Namespaces duplicate kernel data structures so processes see different:

Namespace Isolates
PID Process IDs
Mount Filesystem mount tree
Network Interfaces, routes, iptables/nftables
UTS Hostname
IPC SysV IPC, POSIX mq
User UID/GID mappings
Cgroup cgroup hierarchy view

Containers combine namespaces with images; they are not VMs—see Linux on Windows, WSL, containers, and VMs.

cgroups for resource limits

cgroups limit and account CPU, memory, I/O, and pids. systemd places services in slices; Docker and Kubernetes set cgroup limits on containers.

Terminal window
systemd-cgtop
cat /proc/self/cgroup

OOM within a cgroup kills member processes, not necessarily the whole host—behavior depends on MemoryMax= on units and container runtime settings.

seccomp and syscall filtering

seccomp filters which system calls a process may invoke. Docker and systemd can apply profiles; violations fail closed (process killed) or return errors.

Profiles trade compatibility for containment—stricter filters break apps that use rare syscalls. Test after upgrades.

AppArmor on Debian and SELinux elsewhere

LSM (Linux Security Modules) adds MAC policies:

  • AppArmor — path-based profiles; default on Debian for many services (/etc/apparmor.d/). aa-status shows enforced profiles.
  • SELinux — label-based; dominant on RHEL/Fedora (getenforce).

Debian enables AppArmor profiles shipped with packages (nginx, tcpdump). Custom profiles need testing after path changes.

Profiles complement file modes: even if a process reads a file, MAC may deny it.

How containers combine the stack

A typical container runtime:

  1. Namespaces for PID, mount, network, uts, ipc, user (optional).
  2. cgroups for CPU/memory/pids.
  3. Capabilities dropped; maybe seccomp profile.
  4. Read-only root, tmpfs mounts, and MAC (AppArmor/SELinux) if configured.

Host nftables and SSH hardening still matter—the kernel is shared. Docker overview describes user-facing container workflows; this chapter is the kernel-side vocabulary.

Networking on the host stack is next: Networking on Linux.

The next chapter is Networking on Linux.

Check your understanding

Question 1 of 6

0 of 6 checked

  1. 1. What do Linux capabilities split according to the article?

Search articles

Type a word to search published articles.

Open the search page