]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/nsenter.1
Manual pages: Standardize on OPTIONS as section title
[thirdparty/util-linux.git] / sys-utils / nsenter.1
1 .TH NSENTER 1 "June 2013" "util-linux" "User Commands"
2 .SH NAME
3 nsenter \- run program with namespaces of other processes
4 .SH SYNOPSIS
5 .B nsenter
6 [options]
7 .RI [ program
8 .RI [ arguments ]]
9 .SH DESCRIPTION
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).
12 .PP
13 Enterable namespaces are:
14 .TP
15 .B mount namespace
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
19 \fBshared\fP flag).
20 For further details, see
21 .BR mount_namespaces (7)
22 and the discussion of the
23 .B CLONE_NEWNS
24 flag in
25 .BR clone (2).
26 .TP
27 .B UTS namespace
28 Setting hostname or domainname will not affect the rest of the system.
29 For further details, see
30 .BR namespaces (7)
31 and the discussion of the
32 .B CLONE_NEWUTS
33 flag in
34 .BR clone (2).
35 .TP
36 .B IPC namespace
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 namespaces (7)
42 and the discussion of the
43 .B CLONE_NEWIPC
44 flag in
45 .BR clone (2).
46 .TP
47 .B network namespace
48 The process will have independent IPv4 and IPv6 stacks, IP routing tables,
49 firewall rules, the
50 .I /proc\:/net
51 and
52 .I /sys\:/class\:/net
53 directory trees, sockets, etc.
54 For further details, see
55 .BR namespaces (7)
56 and the discussion of the
57 .B CLONE_NEWNET
58 flag in
59 .BR clone (2).
60 .TP
61 .B PID namespace
62 Children will have a set of PID to process mappings separate from the
63 .B nsenter
64 process.
65 .B nsenter
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)
71 and
72 the discussion of the
73 .B CLONE_NEWPID
74 flag in
75 .BR clone (2).
76 .TP
77 .B user namespace
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
82 .B CLONE_NEWUSER
83 flag in
84 .BR clone (2).
85 .TP
86 .B cgroup namespace
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
92 .B CLONE_NEWCGROUP
93 flag in
94 .BR clone (2).
95 .TP
96 .B time namespace
97 The process can have a distinct view of
98 .B CLOCK_MONOTONIC
99 and/or
100 .B CLOCK_BOOTTIME
101 which can be changed using \fI/proc/self/timens_offsets\fP.
102 .TP
103 See \fBclone\fP(2) for the exact semantics of the flags.
104 .SH OPTIONS
105 Various of the options below that relate to namespaces take an optional
106 .I file
107 argument.
108 This should be one of the
109 .I /proc/[pid]/ns/*
110 files described in
111 .BR namespaces (7).
112 .TP
113 \fB\-a\fR, \fB\-\-all\fR
114 Enter all namespaces of the target process by the default
115 .I /proc/[pid]/ns/*
116 namespace paths. The default paths to the target process namespaces may be
117 overwritten by namespace specific options (e.g., --all --mount=[path]).
118
119 The user namespace will be ignored if the same as the caller's current user
120 namespace. It prevents a caller that has dropped capabilities from regaining
121 those capabilities via a call to setns(). See
122 .BR setns (2)
123 for more details.
124 .TP
125 \fB\-t\fR, \fB\-\-target\fR \fIpid\fP
126 Specify a target process to get contexts from. The paths to the contexts
127 specified by
128 .I pid
129 are:
130 .RS
131 .PD 0
132 .IP "" 20
133 .TP
134 /proc/\fIpid\fR/ns/mnt
135 the mount namespace
136 .TP
137 /proc/\fIpid\fR/ns/uts
138 the UTS namespace
139 .TP
140 /proc/\fIpid\fR/ns/ipc
141 the IPC namespace
142 .TP
143 /proc/\fIpid\fR/ns/net
144 the network namespace
145 .TP
146 /proc/\fIpid\fR/ns/pid
147 the PID namespace
148 .TP
149 /proc/\fIpid\fR/ns/user
150 the user namespace
151 .TP
152 /proc/\fIpid\fR/ns/cgroup
153 the cgroup namespace
154 .TP
155 /proc/\fIpid\fR/ns/time
156 the time namespace
157 .TP
158 /proc/\fIpid\fR/root
159 the root directory
160 .TP
161 /proc/\fIpid\fR/cwd
162 the working directory respectively
163 .PD
164 .RE
165 .TP
166 \fB\-m\fR, \fB\-\-mount\fR[=\fIfile\fR]
167 Enter the mount namespace. If no file is specified, enter the mount namespace
168 of the target process.
169 If
170 .I file
171 is specified, enter the mount namespace
172 specified by
173 .IR file .
174 .TP
175 \fB\-u\fR, \fB\-\-uts\fR[=\fIfile\fR]
176 Enter the UTS namespace. If no file is specified, enter the UTS namespace of
177 the target process.
178 If
179 .I file
180 is specified, enter the UTS namespace specified by
181 .IR file .
182 .TP
183 \fB\-i\fR, \fB\-\-ipc\fR[=\fIfile\fR]
184 Enter the IPC namespace. If no file is specified, enter the IPC namespace of
185 the target process.
186 If
187 .I file
188 is specified, enter the IPC namespace specified by
189 .IR file .
190 .TP
191 \fB\-n\fR, \fB\-\-net\fR[=\fIfile\fR]
192 Enter the network namespace. If no file is specified, enter the network
193 namespace of the target process.
194 If
195 .I file
196 is specified, enter the network namespace specified by
197 .IR file .
198 .TP
199 \fB\-p\fR, \fB\-\-pid\fR[=\fIfile\fR]
200 Enter the PID namespace. If no file is specified, enter the PID namespace of
201 the target process.
202 If
203 .I file
204 is specified, enter the PID namespace specified by
205 .IR file .
206 .TP
207 \fB\-U\fR, \fB\-\-user\fR[=\fIfile\fR]
208 Enter the user namespace. If no file is specified, enter the user namespace of
209 the target process.
210 If
211 .I file
212 is specified, enter the user namespace specified by
213 .IR file .
214 See also the \fB\-\-setuid\fR and \fB\-\-setgid\fR options.
215 .TP
216 \fB\-C\fR, \fB\-\-cgroup\fR[=\fIfile\fR]
217 Enter the cgroup namespace. If no file is specified, enter the cgroup namespace of
218 the target process.
219 If
220 .I file
221 is specified, enter the cgroup namespace specified by
222 .IR file .
223 .TP
224 \fB\-T\fR, \fB\-\-time\fR[=\fIfile\fR]
225 Enter the time namespace. If no file is specified, enter the time namespace of
226 the target process.
227 If
228 .I file
229 is specified, enter the time namespace specified by
230 .IR file .
231 .TP
232 \fB\-G\fR, \fB\-\-setgid\fR \fIgid\fR
233 Set the group ID which will be used in the entered namespace and drop
234 supplementary groups.
235 .BR nsenter (1)
236 always sets GID for user namespaces, the default is 0.
237 .TP
238 \fB\-S\fR, \fB\-\-setuid\fR \fIuid\fR
239 Set the user ID which will be used in the entered namespace.
240 .BR nsenter (1)
241 always sets UID for user namespaces, the default is 0.
242 .TP
243 \fB\-\-preserve\-credentials\fR
244 Don't modify UID and GID when enter user namespace. The default is to
245 drops supplementary groups and sets GID and UID to 0.
246 .TP
247 \fB\-r\fR, \fB\-\-root\fR[=\fIdirectory\fR]
248 Set the root directory. If no directory is specified, set the root directory to
249 the root directory of the target process. If directory is specified, set the
250 root directory to the specified directory.
251 .TP
252 \fB\-w\fR, \fB\-\-wd\fR[=\fIdirectory\fR]
253 Set the working directory. If no directory is specified, set the working
254 directory to the working directory of the target process. If directory is
255 specified, set the working directory to the specified directory.
256 .TP
257 \fB\-F\fR, \fB\-\-no\-fork\fR
258 Do not fork before exec'ing the specified program. By default, when entering a
259 PID namespace, \fBnsenter\fP calls \fBfork\fP before calling \fBexec\fP so that
260 any children will also be in the newly entered PID namespace.
261 .TP
262 \fB\-Z\fR, \fB\-\-follow\-context\fR
263 Set the SELinux security context used for executing a new process according to
264 already running process specified by \fB\-\-target\fR PID. (The util-linux has
265 to be compiled with SELinux support otherwise the option is unavailable.)
266 .TP
267 \fB\-V\fR, \fB\-\-version\fR
268 Display version information and exit.
269 .TP
270 \fB\-h\fR, \fB\-\-help\fR
271 Display help text and exit.
272 .SH SEE ALSO
273 .BR clone (2),
274 .BR setns (2),
275 .BR namespaces (7)
276 .SH AUTHORS
277 .UR biederm@xmission.com
278 Eric Biederman
279 .UE
280 .br
281 .UR kzak@redhat.com
282 Karel Zak
283 .UE
284 .SH AVAILABILITY
285 The nsenter command is part of the util-linux package and is available from
286 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
287 Linux Kernel Archive
288 .UE .