LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

A container is run --user 1000:1000 --cap-add chown and tries to chown a file, but gets Operation not permitted. Why?

Capabilities apply to the root user (UID 0). As a non-root user (UID 1000) the process isn't the file owner and isn't root, so even with CAP_CHOWN granted it can't change ownership — the two controls stack.

This card ties two defences together and shows they are independent, additive layers:

  • Capabilities govern what a privileged (root) process may do. CAP_CHOWN lets root change any file's owner.
  • Running --user 1000:1000 means the process is not root. Ordinary permission rules still apply: a non-owner, non-root user may not chown a file, full stop.

So granting --cap-add chown to a non-root process doesn't help — capabilities refine root's powers, they don't elevate a normal user to be able to do root-only things in general. The chown is denied by the ordinary DAC permission check before the capability ever comes into play.

The security takeaway is reassuring: combining non-root and dropped capabilities is stronger than either alone. An attacker would need both a way to become root in the container and the specific capability for the operation — defence in depth. (By contrast, running as root --cap-add chown does let the chown succeed, because then the process is UID 0.)

Layered container hardening: non-root user, dropped capabilities, seccomp, AppArmor, cgroups and user namespaces keep the host safe

* Non-root AND dropped capabilities stack — defence in depth. *

Go deeper:

From Quiz: ISLAB / Docker Security | Updated: Nov 26, 2026