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
30 .BR uts_namespaces (7)
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
41 .BR ipc_namespaces (7)
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
55 .BR network_namespaces (7)
56 and the discussion of the
62 Children will have a set of PID to process mappings separate from the
66 will fork by default if changing the PID namespace, so that the new program
67 and its children share the same PID namespace and are visible to each other.
68 If \fB\-\-no\-fork\fP is used, the new program will be exec'ed without forking.
69 For further details, see
70 .BR pid_namespaces (7)
78 The process will have a distinct set of UIDs, GIDs and capabilities.
79 For further details, see
80 .BR user_namespaces (7)
81 and the discussion of the
87 The process will have a virtualized view of \fI/proc\:/self\:/cgroup\fP, and new
88 cgroup mounts will be rooted at the namespace cgroup root.
89 For further details, see
90 .BR cgroup_namespaces (7)
91 and the discussion of the
97 The process can have a distinct view of
101 which can be changed using \fI/proc/self/timens_offsets\fP.
102 For further details, see
103 .BR time_namespaces (7).
105 See \fBclone\fP(2) for the exact semantics of the flags.
107 Various of the options below that relate to namespaces take an optional
110 This should be one of the
115 \fB\-a\fR, \fB\-\-all\fR
116 Enter all namespaces of the target process by the default
118 namespace paths. The default paths to the target process namespaces may be
119 overwritten by namespace specific options (e.g., --all --mount=[path]).
121 The user namespace will be ignored if the same as the caller's current user
122 namespace. It prevents a caller that has dropped capabilities from regaining
123 those capabilities via a call to setns(). See
127 \fB\-t\fR, \fB\-\-target\fR \fIpid\fP
128 Specify a target process to get contexts from. The paths to the contexts
136 /proc/\fIpid\fR/ns/mnt
139 /proc/\fIpid\fR/ns/uts
142 /proc/\fIpid\fR/ns/ipc
145 /proc/\fIpid\fR/ns/net
146 the network namespace
148 /proc/\fIpid\fR/ns/pid
151 /proc/\fIpid\fR/ns/user
154 /proc/\fIpid\fR/ns/cgroup
157 /proc/\fIpid\fR/ns/time
164 the working directory respectively
168 \fB\-m\fR, \fB\-\-mount\fR[=\fIfile\fR]
169 Enter the mount namespace. If no file is specified, enter the mount namespace
170 of the target process.
173 is specified, enter the mount namespace
177 \fB\-u\fR, \fB\-\-uts\fR[=\fIfile\fR]
178 Enter the UTS namespace. If no file is specified, enter the UTS namespace of
182 is specified, enter the UTS namespace specified by
185 \fB\-i\fR, \fB\-\-ipc\fR[=\fIfile\fR]
186 Enter the IPC namespace. If no file is specified, enter the IPC namespace of
190 is specified, enter the IPC namespace specified by
193 \fB\-n\fR, \fB\-\-net\fR[=\fIfile\fR]
194 Enter the network namespace. If no file is specified, enter the network
195 namespace of the target process.
198 is specified, enter the network namespace specified by
201 \fB\-p\fR, \fB\-\-pid\fR[=\fIfile\fR]
202 Enter the PID namespace. If no file is specified, enter the PID namespace of
206 is specified, enter the PID namespace specified by
209 \fB\-U\fR, \fB\-\-user\fR[=\fIfile\fR]
210 Enter the user namespace. If no file is specified, enter the user namespace of
214 is specified, enter the user namespace specified by
216 See also the \fB\-\-setuid\fR and \fB\-\-setgid\fR options.
218 \fB\-C\fR, \fB\-\-cgroup\fR[=\fIfile\fR]
219 Enter the cgroup namespace. If no file is specified, enter the cgroup namespace of
223 is specified, enter the cgroup namespace specified by
226 \fB\-T\fR, \fB\-\-time\fR[=\fIfile\fR]
227 Enter the time namespace. If no file is specified, enter the time namespace of
231 is specified, enter the time namespace specified by
234 \fB\-G\fR, \fB\-\-setgid\fR \fIgid\fR
235 Set the group ID which will be used in the entered namespace and drop
236 supplementary groups.
238 always sets GID for user namespaces, the default is 0.
240 \fB\-S\fR, \fB\-\-setuid\fR \fIuid\fR
241 Set the user ID which will be used in the entered namespace.
243 always sets UID for user namespaces, the default is 0.
245 \fB\-\-preserve\-credentials\fR
246 Don't modify UID and GID when enter user namespace. The default is to
247 drops supplementary groups and sets GID and UID to 0.
249 \fB\-r\fR, \fB\-\-root\fR[=\fIdirectory\fR]
250 Set the root directory. If no directory is specified, set the root directory to
251 the root directory of the target process. If directory is specified, set the
252 root directory to the specified directory.
254 \fB\-w\fR, \fB\-\-wd\fR[=\fIdirectory\fR]
255 Set the working directory. If no directory is specified, set the working
256 directory to the working directory of the target process. If directory is
257 specified, set the working directory to the specified directory.
259 \fB\-F\fR, \fB\-\-no\-fork\fR
260 Do not fork before exec'ing the specified program. By default, when entering a
261 PID namespace, \fBnsenter\fP calls \fBfork\fP before calling \fBexec\fP so that
262 any children will also be in the newly entered PID namespace.
264 \fB\-Z\fR, \fB\-\-follow\-context\fR
265 Set the SELinux security context used for executing a new process according to
266 already running process specified by \fB\-\-target\fR PID. (The util-linux has
267 to be compiled with SELinux support otherwise the option is unavailable.)
269 \fB\-V\fR, \fB\-\-version\fR
270 Display version information and exit.
272 \fB\-h\fR, \fB\-\-help\fR
273 Display help text and exit.
275 .UR biederm@xmission.com
287 The nsenter command is part of the util-linux package and is available from
288 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/