]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/nsenter.1
docs: restore minus symbols in long opts
[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 See \fBclone\fP(2) for the exact semantics of the flags.
58 .TP
59 If \fIprogram\fP is not given, then ``${SHELL}'' is run (default: /bin\:/sh).
60
61 .SH OPTIONS
62 .TP
63 \fB\-t\fR, \fB\-\-target\fR \fIpid\fP
64 Specify a target process to get contexts from. The paths to the contexts
65 specified by
66 .I pid
67 are:
68 .RS
69 .PD 0
70 .IP "" 20
71 .TP
72 /proc/\fIpid\fR/ns/mnt
73 the mount namespace
74 .TP
75 /proc/\fIpid\fR/ns/uts
76 the UTS namespace
77 .TP
78 /proc/\fIpid\fR/ns/ipc
79 the IPC namespace
80 .TP
81 /proc/\fIpid\fR/ns/net
82 the network namespace
83 .TP
84 /proc/\fIpid\fR/ns/pid
85 the PID namespace
86 .TP
87 /proc/\fIpid\fR/ns/user
88 the user namespace
89 .TP
90 /proc/\fIpid\fR/root
91 the root directory
92 .TP
93 /proc/\fIpid\fR/cwd
94 the working directory respectively
95 .PD
96 .RE
97 .TP
98 \fB\-m\fR, \fB\-\-mount\fR[=\fIfile\fR]
99 Enter the mount namespace. If no file is specified, enter the mount namespace
100 of the target process. If file is specified, enter the mount namespace
101 specified by file.
102 .TP
103 \fB\-u\fR, \fB\-\-uts\fR[=\fIfile\fR]
104 Enter the UTS namespace. If no file is specified, enter the UTS namespace of
105 the target process. If file is specified, enter the UTS namespace specified by
106 file.
107 .TP
108 \fB\-i\fR, \fB\-\-ipc\fR[=\fIfile\fR]
109 Enter the IPC namespace. If no file is specified, enter the IPC namespace of
110 the target process. If file is specified, enter the IPC namespace specified by
111 file.
112 .TP
113 \fB\-n\fR, \fB\-\-net\fR[=\fIfile\fR]
114 Enter the network namespace. If no file is specified, enter the network
115 namespace of the target process. If file is specified, enter the network
116 namespace specified by file.
117 .TP
118 \fB\-p\fR, \fB\-\-pid\fR[=\fIfile\fR]
119 Enter the PID namespace. If no file is specified, enter the PID namespace of
120 the target process. If file is specified, enter the PID namespace specified by
121 file.
122 .TP
123 \fB\-U\fR, \fB\-\-user\fR[=\fIfile\fR]
124 Enter the user namespace. If no file is specified, enter the user namespace of
125 the target process. If file is specified, enter the user namespace specified by
126 file. See also the \fB\-\-setuid\fR and \fB\-\-setgid\fR options.
127 .TP
128 \fB\-G\fR, \fB\-\-setgid\fR \fIgid\fR
129 Set the group ID which will be used in the entered namespace and drop
130 supplementary groups.
131 .BR nsenter (1)
132 always sets GID for user namespaces, the default is 0.
133 .TP
134 \fB\-S\fR, \fB\-\-setuid\fR \fIuid\fR
135 Set the user ID which will be used in the entered namespace.
136 .BR nsenter (1)
137 always sets UID for user namespaces, the default is 0.
138 .TP
139 \fB\-\-preserve\-credentials\fR
140 Don't modify UID and GID when enter user namespace. The default is to
141 drops supplementary groups and sets GID and UID to 0.
142 .TP
143 \fB\-r\fR, \fB\-\-root\fR[=\fIdirectory\fR]
144 Set the root directory. If no directory is specified, set the root directory to
145 the root directory of the target process. If directory is specified, set the
146 root directory to the specified directory.
147 .TP
148 \fB\-w\fR, \fB\-\-wd\fR[=\fIdirectory\fR]
149 Set the working directory. If no directory is specified, set the working
150 directory to the working directory of the target process. If directory is
151 specified, set the working directory to the specified directory.
152 .TP
153 \fB\-F\fR, \fB\-\-no\-fork\fR
154 Do not fork before exec'ing the specified program. By default, when entering a
155 PID namespace, \fBnsenter\fP calls \fBfork\fP before calling \fBexec\fP so that
156 any children will also be in the newly entered PID namespace.
157 .TP
158 \fB\-V\fR, \fB\-\-version\fR
159 Display version information and exit.
160 .TP
161 \fB\-h\fR, \fB\-\-help\fR
162 Display help text and exit.
163 .SH SEE ALSO
164 .BR setns (2),
165 .BR clone (2)
166 .SH AUTHOR
167 .MT ebiederm@xmission.com
168 Eric Biederman
169 .ME
170 .SH AVAILABILITY
171 The nsenter command is part of the util-linux package and is available from
172 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
173 Linux Kernel Archive
174 .UE .