OS Manuals

/usr/bin/unshare

Misc binaries for util-linux

From util-linux-misc 2.42.4-r2 (os), captured 2026-11-05 by running unshare --help (exit 0). permalink

Usage:
 unshare [options] [<program> [<argument>...]]

Run a program with some namespaces unshared from the parent.

Options:
 -m, --mount[=<file>]      unshare mounts namespace
 -u, --uts[=<file>]        unshare UTS namespace (hostname etc)
 -i, --ipc[=<file>]        unshare System V IPC namespace
 -n, --net[=<file>]        unshare network namespace
 -p, --pid[=<file>]        unshare pid namespace
 -U, --user[=<file>]       unshare user namespace
 -C, --cgroup[=<file>]     unshare cgroup namespace
 -T, --time[=<file>]       unshare time namespace

 --mount-proc[=<dir>]      mount proc filesystem first (implies --mount)
 --mount-binfmt[=<dir>]    mount binfmt filesystem first (implies --user and --mount)
 -l, --load-interp <file>  load binfmt definition in the namespace (implies --mount-binfmt)
 --propagation slave|shared|private|unchanged
                           modify mount propagation in mount namespace
 -R, --root <dir>          run the command with root directory set to <dir>
 -w, --wd <dir>            change working directory to <dir>

 -S, --setuid <uid>        set uid in entered namespace
 -G, --setgid <gid>        set gid in entered namespace
 --map-user <uid>|<name>   map current user to uid (implies --user)
 --map-group <gid>|<name>  map current group to gid (implies --user)
 -r, --map-root-user       map current user to root (implies --user)
 -c, --map-current-user    map current user to itself (implies --user)
 --map-auto                map users and groups automatically (implies --user)
 --map-subids              map the first block of user IDs owned by euid (implies --user)
 --map-users <inneruid>:<outeruid>:<count>
                           map count users from outeruid to inneruid (implies --user)
 --map-groups <innergid>:<outergid>:<count>
                           map count groups from outergid to innergid (implies --user)
 --owner <uid>:<gid>       set the user namespace owner (implies --user)

 -f, --fork                fork before launching <program>
 --kill-child[=<signame>]  when dying, kill the forked child (implies --fork)
                             defaults to SIGKILL
 --forward-signals         forward SIGTERM and SIGINT to child (implies --fork)

 --setgroups allow|deny    control the setgroups syscall in user namespaces
 --keep-caps               retain capabilities granted in user namespaces

 --monotonic <offset>      set clock monotonic offset (seconds) in time namespaces
 --boottime <offset>       set clock boottime offset (seconds) in time namespaces

 -h, --help                display this help
 -V, --version             display version

For more details see unshare(1).
Options (34)
OptionDescriptionSource
-m, --mount fileCreate a new mount namespace.help + man
-u, --uts fileunshare UTS namespace (hostname etc)help + man
-i, --ipc fileunshare System V IPC namespacehelp + man
-n, --net fileCreate a new network namespace.help + man
-p, --pid fileCreate a new PID namespace.help + man
-U, --user fileCreate a new user namespace.help + man
-C, --cgroup fileCreate a new cgroup namespace.help + man
-T, --time fileCreate a new time namespace.help + man
--mount-proc dirJust before running the program, mount the proc filesystem at mountpoint (default is /proc).help + man
--mount-binfmt dirJust before running the program, mount the binfmt_misc filesystem at mountpoint (default is /proc/sys/fs/binfmt_misc).help + man
-l, --load-interp fileLoad binfmt_misc definition in the namespace (implies --mount-binfmt).help + man
--propagation slave|shared|private|unchangedRecursively set the mount propagation flag in the new mount namespace.help + man
-R, --root dirrun the command with root directory set to <dir>help + man
-w, --wd dirchange working directory to <dir>help + man
-S, --setuid uidSet the user ID which will be used in the entered namespace.help + man
-G, --setgid gidSet the group ID which will be used in the entered namespace and drop supplementary groups.help + man
--map-user uid>|<nameRun the program only after the current effective user ID has been mapped to uid.help + man
--map-group gid>|<nameRun the program only after the current effective group ID has been mapped to gid.help + man
-r, --map-root-userRun the program only after the current effective user and group IDs have been mapped to the superuser UID and GID in the newly created user namespace.help + man
-c, --map-current-userRun the program only after the current effective user and group IDs have been mapped to the same UID and GID in the newly created user namespace.help + man
--map-autoMap the first block of user IDs owned by the effective user from /etc/subuid to a block starting at user ID 0.help + man
--map-subidsIdentity map the first block of user IDs owned by the effective user from /etc/subuid.help + man
--map-users inneruid>:<outeruid>:<countRun the program only after the block of user IDs of size count beginning at outeruid has been mapped to the block of user IDs beginning at inneruid.help + man
--map-groups innergid>:<outergid>:<countRun the program only after the block of group IDs of size count beginning at outergid has been mapped to the block of group IDs beginning at innergid.help + man
--owner uid>:<gidSet the owner user and group when creating a user namespace.help + man
-f, --forkFork the specified program as a child process of unshare rather than running it directly.help + man
--kill-child signameWhen unshare terminates, have signame be sent to the forked child process.help + man
--forward-signalsForward SIGTERM and SIGINT signals received by the parent unshare process to the child process.help + man
--setgroups allow|denyAllow or deny the setgroups(2) system call in a user namespace.help + man
--keep-capsWhen the --user option is given, ensure that capabilities granted in the user namespace are preserved in the child process.help + man
--monotonic offsetSet the offset of CLOCK_MONOTONIC which will be used in the entered time namespace.help + man
--boottime offsetSet the offset of CLOCK_BOOTTIME which will be used in the entered time namespace.help + man
-h, --helpDisplay help text and exit.help + man
-V, --versionDisplay version and exit.help + man
Examples (12) from the manual page, untested

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.