1 .TH NSENTER 1 "June 2013" "util-linux" "User Commands"
3 nsenter \- run program with namespaces of other processes
10 Enters the namespaces of one or more other processes and then executes the specified
11 \fIprogram\fP. If \fIprogram\fP is not given, then ``${SHELL}'' is run (default: /bin\:/sh).
13 Enterable namespaces are:
16 Mounting and unmounting filesystems will not affect the rest of the system,
17 except for filesystems which are explicitly marked as shared (with
18 \fBmount --make-\:shared\fP; see \fI/proc\:/self\:/mountinfo\fP for the
20 For further details, see
21 .BR mount_namespaces (7)
22 and the discussion of the
28 Setting hostname or domainname will not affect the rest of the system.
29 For further details, see
31 and the discussion of the
37 The process will have an independent namespace for POSIX message queues
38 as well as System V message queues,
39 semaphore sets and shared memory segments.
40 For further details, see
42 and the discussion of the
48 The process will have independent IPv4 and IPv6 stacks, IP routing tables,
53 directory trees, sockets, etc.
54 For further details, see
56 and the discussion of the
62 Children will have a set of PID to process mappings separate from the
65 For further details, see
66 .BR pid_namespaces (7)
72 will fork by default if changing the PID namespace, so that the new program
73 and its children share the same PID namespace and are visible to each other.
74 If \fB\-\-no\-fork\fP is used, the new program will be exec'ed without forking.
77 The process will have a distinct set of UIDs, GIDs and capabilities.
78 For further details, see
79 .BR user_namespaces (7)
80 and the discussion of the
86 The process will have a virtualized view of \fI/proc\:/self\:/cgroup\fP, and new
87 cgroup mounts will be rooted at the namespace cgroup root.
88 For further details, see
89 .BR cgroup_namespaces (7)
90 and the discussion of the
95 See \fBclone\fP(2) for the exact semantics of the flags.
97 Various of the options below that relate to namespaces take an optional
100 This should be one of the
105 \fB\-a\fR, \fB\-\-all\fR
106 Enter all namespaces of the target process by the default
108 namespace paths. The default paths to the target process namespaces may be
109 overwritten by namespace specific options (e.g. --all --mount=[path]).
111 The user namespace will be ignored if the same as the caller's current user
112 namespace. It prevents a caller that has dropped capabilities from regaining
113 those capabilities via a call to setns(). See
117 \fB\-t\fR, \fB\-\-target\fR \fIpid\fP
118 Specify a target process to get contexts from. The paths to the contexts
126 /proc/\fIpid\fR/ns/mnt
129 /proc/\fIpid\fR/ns/uts
132 /proc/\fIpid\fR/ns/ipc
135 /proc/\fIpid\fR/ns/net
136 the network namespace
138 /proc/\fIpid\fR/ns/pid
141 /proc/\fIpid\fR/ns/user
144 /proc/\fIpid\fR/ns/cgroup
151 the working directory respectively
155 \fB\-m\fR, \fB\-\-mount\fR[=\fIfile\fR]
156 Enter the mount namespace. If no file is specified, enter the mount namespace
157 of the target process.
160 is specified, enter the mount namespace
164 \fB\-u\fR, \fB\-\-uts\fR[=\fIfile\fR]
165 Enter the UTS namespace. If no file is specified, enter the UTS namespace of
169 is specified, enter the UTS namespace specified by
172 \fB\-i\fR, \fB\-\-ipc\fR[=\fIfile\fR]
173 Enter the IPC namespace. If no file is specified, enter the IPC namespace of
177 is specified, enter the IPC namespace specified by
180 \fB\-n\fR, \fB\-\-net\fR[=\fIfile\fR]
181 Enter the network namespace. If no file is specified, enter the network
182 namespace of the target process.
185 is specified, enter the network namespace specified by
188 \fB\-p\fR, \fB\-\-pid\fR[=\fIfile\fR]
189 Enter the PID namespace. If no file is specified, enter the PID namespace of
193 is specified, enter the PID namespace specified by
196 \fB\-U\fR, \fB\-\-user\fR[=\fIfile\fR]
197 Enter the user namespace. If no file is specified, enter the user namespace of
201 is specified, enter the user namespace specified by
203 See also the \fB\-\-setuid\fR and \fB\-\-setgid\fR options.
205 \fB\-C\fR, \fB\-\-cgroup\fR[=\fIfile\fR]
206 Enter the cgroup namespace. If no file is specified, enter the cgroup namespace of
210 is specified, enter the cgroup namespace specified by
213 \fB\-G\fR, \fB\-\-setgid\fR \fIgid\fR
214 Set the group ID which will be used in the entered namespace and drop
215 supplementary groups.
217 always sets GID for user namespaces, the default is 0.
219 \fB\-S\fR, \fB\-\-setuid\fR \fIuid\fR
220 Set the user ID which will be used in the entered namespace.
222 always sets UID for user namespaces, the default is 0.
224 \fB\-\-preserve\-credentials\fR
225 Don't modify UID and GID when enter user namespace. The default is to
226 drops supplementary groups and sets GID and UID to 0.
228 \fB\-r\fR, \fB\-\-root\fR[=\fIdirectory\fR]
229 Set the root directory. If no directory is specified, set the root directory to
230 the root directory of the target process. If directory is specified, set the
231 root directory to the specified directory.
233 \fB\-w\fR, \fB\-\-wd\fR[=\fIdirectory\fR]
234 Set the working directory. If no directory is specified, set the working
235 directory to the working directory of the target process. If directory is
236 specified, set the working directory to the specified directory.
238 \fB\-F\fR, \fB\-\-no\-fork\fR
239 Do not fork before exec'ing the specified program. By default, when entering a
240 PID namespace, \fBnsenter\fP calls \fBfork\fP before calling \fBexec\fP so that
241 any children will also be in the newly entered PID namespace.
243 \fB\-Z\fR, \fB\-\-follow\-context\fR
244 Set the SELinux security context used for executing a new process according to
245 already running process specified by \fB\-\-target\fR PID. (The util-linux has
246 to be compiled with SELinux support otherwise the option is unavailable.)
248 \fB\-V\fR, \fB\-\-version\fR
249 Display version information and exit.
251 \fB\-h\fR, \fB\-\-help\fR
252 Display help text and exit.
258 .UR biederm@xmission.com
266 The nsenter command is part of the util-linux package and is available from
267 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/