]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/nsenter.1
SEE ALSO: add cross reference to namespaces(7)
[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 program. Enterable namespaces are:
12 .TP
13 .B mount namespace
14 Mounting and unmounting filesystems will not affect the rest of the system
15 .RB ( CLONE_\:NEWNS
16 flag), except for filesystems which are explicitly marked as shared (with
17 \fBmount --make-\:shared\fP; see \fI/proc\:/self\:/mountinfo\fP for the
18 \fBshared\fP flag).
19 .TP
20 .B UTS namespace
21 Setting hostname or domainname will not affect the rest of the system.
22 .RB ( CLONE_\:NEWUTS
23 flag)
24 .TP
25 .B IPC namespace
26 The process will have an independent namespace for System V message queues,
27 semaphore sets and shared memory segments.
28 .RB ( CLONE_\:NEWIPC
29 flag)
30 .TP
31 .B network namespace
32 The process will have independent IPv4 and IPv6 stacks, IP routing tables,
33 firewall rules, the
34 .I /proc\:/net
35 and
36 .I /sys\:/class\:/net
37 directory trees, sockets, etc.
38 .RB ( CLONE_\:NEWNET
39 flag)
40 .TP
41 .B PID namespace
42 Children will have a set of PID to process mappings separate from the
43 .B nsenter
44 process
45 .RB ( CLONE_\:NEWPID
46 flag).
47 .B nsenter
48 will fork by default if changing the PID namespace, so that the new program
49 and its children share the same PID namespace and are visible to each other.
50 If \fB\-\-no\-fork\fP is used, the new program will be exec'ed without forking.
51 .TP
52 .B user namespace
53 The process will have a distinct set of UIDs, GIDs and capabilities.
54 .RB ( CLONE_\:NEWUSER
55 flag)
56 .TP
57 .B cgroup namespace
58 The process will have a virtualized view of \fI/proc\:/self\:/cgroup\fP, and new
59 cgroup mounts will be rooted at the namespace cgroup root.
60 .RB ( CLONE_\:NEWCGROUP
61 flag)
62 .TP
63 See \fBclone\fP(2) for the exact semantics of the flags.
64 .TP
65 If \fIprogram\fP is not given, then ``${SHELL}'' is run (default: /bin\:/sh).
66
67 .SH OPTIONS
68 .TP
69 \fB\-t\fR, \fB\-\-target\fR \fIpid\fP
70 Specify a target process to get contexts from. The paths to the contexts
71 specified by
72 .I pid
73 are:
74 .RS
75 .PD 0
76 .IP "" 20
77 .TP
78 /proc/\fIpid\fR/ns/mnt
79 the mount namespace
80 .TP
81 /proc/\fIpid\fR/ns/uts
82 the UTS namespace
83 .TP
84 /proc/\fIpid\fR/ns/ipc
85 the IPC namespace
86 .TP
87 /proc/\fIpid\fR/ns/net
88 the network namespace
89 .TP
90 /proc/\fIpid\fR/ns/pid
91 the PID namespace
92 .TP
93 /proc/\fIpid\fR/ns/user
94 the user namespace
95 .TP
96 /proc/\fIpid\fR/ns/cgroup
97 the cgroup namespace
98 .TP
99 /proc/\fIpid\fR/root
100 the root directory
101 .TP
102 /proc/\fIpid\fR/cwd
103 the working directory respectively
104 .PD
105 .RE
106 .TP
107 \fB\-m\fR, \fB\-\-mount\fR[=\fIfile\fR]
108 Enter the mount namespace. If no file is specified, enter the mount namespace
109 of the target process. If file is specified, enter the mount namespace
110 specified by file.
111 .TP
112 \fB\-u\fR, \fB\-\-uts\fR[=\fIfile\fR]
113 Enter the UTS namespace. If no file is specified, enter the UTS namespace of
114 the target process. If file is specified, enter the UTS namespace specified by
115 file.
116 .TP
117 \fB\-i\fR, \fB\-\-ipc\fR[=\fIfile\fR]
118 Enter the IPC namespace. If no file is specified, enter the IPC namespace of
119 the target process. If file is specified, enter the IPC namespace specified by
120 file.
121 .TP
122 \fB\-n\fR, \fB\-\-net\fR[=\fIfile\fR]
123 Enter the network namespace. If no file is specified, enter the network
124 namespace of the target process. If file is specified, enter the network
125 namespace specified by file.
126 .TP
127 \fB\-p\fR, \fB\-\-pid\fR[=\fIfile\fR]
128 Enter the PID namespace. If no file is specified, enter the PID namespace of
129 the target process. If file is specified, enter the PID namespace specified by
130 file.
131 .TP
132 \fB\-U\fR, \fB\-\-user\fR[=\fIfile\fR]
133 Enter the user namespace. If no file is specified, enter the user namespace of
134 the target process. If file is specified, enter the user namespace specified by
135 file. See also the \fB\-\-setuid\fR and \fB\-\-setgid\fR options.
136 .TP
137 \fB\-C\fR, \fB\-\-cgroup\fR[=\fIfile\fR]
138 Enter the cgroup namespace. If no file is specified, enter the cgroup namespace of
139 the target process. If file is specified, enter the cgroup namespace specified by
140 file.
141 .TP
142 \fB\-G\fR, \fB\-\-setgid\fR \fIgid\fR
143 Set the group ID which will be used in the entered namespace and drop
144 supplementary groups.
145 .BR nsenter (1)
146 always sets GID for user namespaces, the default is 0.
147 .TP
148 \fB\-S\fR, \fB\-\-setuid\fR \fIuid\fR
149 Set the user ID which will be used in the entered namespace.
150 .BR nsenter (1)
151 always sets UID for user namespaces, the default is 0.
152 .TP
153 \fB\-\-preserve\-credentials\fR
154 Don't modify UID and GID when enter user namespace. The default is to
155 drops supplementary groups and sets GID and UID to 0.
156 .TP
157 \fB\-r\fR, \fB\-\-root\fR[=\fIdirectory\fR]
158 Set the root directory. If no directory is specified, set the root directory to
159 the root directory of the target process. If directory is specified, set the
160 root directory to the specified directory.
161 .TP
162 \fB\-w\fR, \fB\-\-wd\fR[=\fIdirectory\fR]
163 Set the working directory. If no directory is specified, set the working
164 directory to the working directory of the target process. If directory is
165 specified, set the working directory to the specified directory.
166 .TP
167 \fB\-F\fR, \fB\-\-no\-fork\fR
168 Do not fork before exec'ing the specified program. By default, when entering a
169 PID namespace, \fBnsenter\fP calls \fBfork\fP before calling \fBexec\fP so that
170 any children will also be in the newly entered PID namespace.
171 .TP
172 \fB\-Z\fR, \fB\-\-follow\-context\fR
173 Set the SELinux security context used for executing a new process according to
174 already running process specified by \fB\-\-target\fR PID. (The util-linux has
175 to be compiled with SELinux support otherwise the option is unavailable.)
176 .TP
177 \fB\-V\fR, \fB\-\-version\fR
178 Display version information and exit.
179 .TP
180 \fB\-h\fR, \fB\-\-help\fR
181 Display help text and exit.
182 .SH SEE ALSO
183 .BR clone (2),
184 .BR setns (2),
185 .BR namespaces (7)
186 .SH AUTHORS
187 .UR biederm@xmission.com
188 Eric Biederman
189 .UE
190 .br
191 .UR kzak@redhat.com
192 Karel Zak
193 .UE
194 .SH AVAILABILITY
195 The nsenter command is part of the util-linux package and is available from
196 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
197 Linux Kernel Archive
198 .UE .