unshare command_examples

unshare command_examples

unshare – run program with some namespaces unshared from parent

# unshare --fork --pid --mount-proc readlink /proc/self
1

Establish a PID namespace, ensure we’re PID 1 in it against newly mounted procfs instance.

$ unshare --map-root-user --user sh -c whoami
root

Establish a user namespace as an unprivileged user with a root user within it.

Leave a Reply

Your email address will not be published. Required fields are marked *