OS Manuals

/usr/bin/nsenter

Run a program with namespaces of other processes

From nsenter 2.42.4-r2 (os), captured 2026-11-05 by running nsenter --help (exit 0). permalink

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

Run a program with namespaces of other processes.

Options:
 -a, --all                     enter all namespaces
 -t, --target <PID>            target process to get namespaces from
 -m, --mount[=<file>|=:<nsid>] enter mount namespace
 -u, --uts[=<file>|=:<nsid>]   enter UTS namespace (hostname etc)
 -i, --ipc[=<file>|=:<nsid>]   enter System V IPC namespace
 -n, --net[=<file>|=:<nsid>]   enter network namespace
 -N, --net-socket <fd>         enter socket's network namespace (needs --target)
 -p, --pid[=<file>|=:<nsid>]   enter pid namespace
 -C, --cgroup[=<file>|=:<nsid>]  enter cgroup namespace
 -U, --user[=<file>|=:<nsid>]  enter user namespace
     --user-parent             enter parent user namespace
 -T, --time[=<file>|=:<nsid>]  enter time namespace
 -S, --setuid[=<uid>]          set uid in entered namespace
 -G, --setgid[=<gid>]          set gid in entered namespace
     --preserve-credentials    do not touch uids or gids
     --keep-caps               retain capabilities granted in user namespaces
 -r, --root[=<dir>]            set the root directory
 -w, --wd[=<dir>]              set the working directory
 -W, --wdns <dir>              set the working directory in namespace
 -e, --env                     inherit environment variables from target process
 -F, --no-fork                 do not fork before exec'ing <program>
 -c, --join-cgroup             join the cgroup of the target process
 -Z, --follow-context          set SELinux context according to --target PID

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

For more details see nsenter(1).
Options (25)
OptionDescriptionSource
-a, --allEnter all namespaces of the target process by the default /proc/<pid>/ns/ namespace paths.help + man
-t, --target PIDSpecify a target process to get contexts from.help + man
-u, --uts file>|=:<nsidenter UTS namespace (hostname etc)help + man
-i, --ipc file>|=:<nsidenter System V IPC namespacehelp + man
-n, --net file>|=:<nsidEnter the network namespace.help + man
-N, --net-socket fdEnter the network namespace of the target process’s socket.help + man
-p, --pid file>|=:<nsidEnter the PID namespace.help + man
-C, --cgroup file>|=:<nsidEnter the cgroup namespace.help + man
-U, --user file>|=:<nsidEnter the user namespace.help + man
--user-parentEnter the parent user namespace.help + man
-T, --time file>|=:<nsidEnter the time namespace.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
--preserve-credentialsDon’t modify UID and GID when entering the 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
-r, --root dirSet the root directory.help + man
-w, --wd dirSet the working directory.help + man
-W, --wdns dirset the working directory in namespacehelp + man
-e, --envPass environment variables from the target process to the new process being created.help + man
-F, --no-forkDo not fork before exec’ing the specified program.help + man
-c, --join-cgroupAdd the initiated process to the cgroup of the target process.help + man
-Z, --follow-contextSet the SELinux security context used for executing a new process according to the already running process specified by --target PID.help + man
-h, --helpDisplay help text and exit.help + man
-V, --versionDisplay version and exit.help + man
-m, --mount file|=:nsidEnter the mount namespace. (in the manual page but not in --help)man

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