Unix & Wire Protocol Digest

Independent technical notebook on POSIX tooling, compilers, and engineering videos.

Operations2026-11-21

Practical systemd Unit Sandboxing Without Breaking Network Daemons

Most network daemons need very little from the host operating system once configuration and TLS credentials are loaded: a listening socket, read-only access to /etc/ssl, and a state directory under /var/lib.

Enabling ProtectSystem=strict, PrivateTmp=true, ProtectHome=true, and NoNewPrivileges=yes eliminates entire classes of accidental or exploitable filesystem writes with zero runtime overhead.

When binding privileged ports below 1024 as a dedicated non-root user, AmbientCapabilities=CAP_NET_BIND_SERVICE avoids running the worker process as UID 0.

[Service]
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
AmbientCapabilities=CAP_NET_BIND_SERVICE

← Back to Posts