]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/unshare.1
hwclock: man regression
[thirdparty/util-linux.git] / sys-utils / unshare.1
CommitLineData
cf8e0bae 1.TH UNSHARE 1 "July 2014" "util-linux" "User Commands"
4205f1fd 2.SH NAME
ef6acdb8 3unshare \- run program with some namespaces unshared from parent
4205f1fd
MG
4.SH SYNOPSIS
5.B unshare
cf8e0bae 6[options]
dde08a87 7.I program
4205f1fd
MG
8.RI [ arguments ]
9.SH DESCRIPTION
dde08a87 10Unshares the indicated namespaces from the parent process and then executes
cf8e0bae 11the specified \fIprogram\fR. The namespaces to be unshared are indicated via
87ec43b6 12options. Unshareable namespaces are:
4205f1fd
MG
13.TP
14.BR "mount namespace"
dde08a87 15Mounting and unmounting filesystems will not affect the rest of the system
bc87f885 16(\fBCLONE_NEWNS\fP flag), except for filesystems which are explicitly marked as
dde08a87
BS
17shared (with \fBmount --make-shared\fP; see \fI/proc/self/mountinfo\fP for the
18\fBshared\fP flags).
cf8e0bae 19.sp
c07f86e7
KZ
20It's recommended to use \fBmount --make-rprivate\fP or \fBmount --make-rslave\fP
21after \fBunshare --mount\fP to make sure that mountpoints in the new namespace
cf8e0bae 22are really unshared from the parental namespace.
4205f1fd
MG
23.TP
24.BR "UTS namespace"
dde08a87
BS
25Setting hostname or domainname will not affect the rest of the system.
26(\fBCLONE_NEWUTS\fP flag)
4205f1fd
MG
27.TP
28.BR "IPC namespace"
dde08a87
BS
29The process will have an independent namespace for System V message queues,
30semaphore sets and shared memory segments. (\fBCLONE_NEWIPC\fP flag)
4205f1fd
MG
31.TP
32.BR "network namespace"
dde08a87
BS
33The process will have independent IPv4 and IPv6 stacks, IP routing tables,
34firewall rules, the \fI/proc/net\fP and \fI/sys/class/net\fP directory trees,
35sockets, etc. (\fBCLONE_NEWNET\fP flag)
4205f1fd 36.TP
bc7f9b95 37.BR "pid namespace"
dde08a87
BS
38Children will have a distinct set of PID to process mappings from their parent.
39(\fBCLONE_NEWPID\fP flag)
bc7f9b95
EB
40.TP
41.BR "user namespace"
dde08a87
BS
42The process will have a distinct set of UIDs, GIDs and capabilities.
43(\fBCLONE_NEWUSER\fP flag)
e41e0f95 44.PP
dde08a87 45See \fBclone\fR(2) for the exact semantics of the flags.
4205f1fd
MG
46.SH OPTIONS
47.TP
ef6acdb8 48.BR \-i , " \-\-ipc"
dde08a87
BS
49Unshare the IPC namespace.
50.TP
51.BR \-m , " \-\-mount"
52Unshare the mount namespace.
4205f1fd 53.TP
ef6acdb8
KZ
54.BR \-n , " \-\-net"
55Unshare the network namespace.
bc7f9b95
EB
56.TP
57.BR \-p , " \-\-pid"
87ec43b6
BS
58Unshare the pid namespace.
59See also the \fB--fork\fP and \fB--mount-proc\fP options.
bc7f9b95 60.TP
dde08a87
BS
61.BR \-u , " \-\-uts"
62Unshare the UTS namespace.
63.TP
bc7f9b95
EB
64.BR \-U , " \-\-user"
65Unshare the user namespace.
5088ec33
MF
66.TP
67.BR \-f , " \-\-fork"
87ec43b6
BS
68Fork the specified \fIprogram\fR as a child process of \fBunshare\fR rather than
69running it directly. This is useful when creating a new pid namespace.
6728ca10 70.TP
87ec43b6 71.BR \-\-mount-proc "[=\fImountpoint\fP]"
cf8e0bae 72Just before running the program, mount the proc filesystem at \fImountpoint\fP
6728ca10
KZ
73(default is /proc). This is useful when creating a new pid namespace. It also
74implies creating a new mount namespace since the /proc mount would otherwise
cf8e0bae 75mess up existing programs on the system. The new proc filesystem is explicitly
c07f86e7 76mounted as private (by MS_PRIVATE|MS_REC).
4da21e37
LR
77.TP
78.BR \-r , " \-\-map-root-user"
cf8e0bae
BS
79Run the program only after the current effective user and group IDs have been mapped to
80the superuser UID and GID in the newly created user namespace. This makes it possible to
81conveniently gain capabilities needed to manage various aspects of the newly created
82namespaces (such as configuring interfaces in the network namespace or mounting filesystems in
83the mount namespace) even when run unprivileged. As a mere convenience feature, it does not support
4da21e37 84more sophisticated use cases, such as mapping multiple ranges of UIDs and GIDs.
fbceefde
KZ
85This option implies --setgroups=deny.
86.TP
87.BR \-s , " \-\-setgroups \fIallow|deny\fP"
88Allow or deny
89.BR setgroups (2)
90syscall in user namespaces.
91
92.BR setgroups(2)
93is only callable with CAP_SETGID and CAP_SETGID in a user
94namespace (since Linux 3.19) does not give you permission to call setgroups(2)
95until after GID map has been set. The GID map is writable by root when
96.BR setgroups(2)
97is enabled and GID map becomes writable by unprivileged processes when
98.BR setgroups(2)
99is permamently disabled.
5e43af7e
BS
100.TP
101.BR \-V , " \-\-version"
102Display version information and exit.
103.TP
104.BR \-h , " \-\-help"
105Display help text and exit.
4205f1fd 106.SH SEE ALSO
8323d9fd 107.BR unshare (2),
c07f86e7
KZ
108.BR clone (2),
109.BR mount (8)
4205f1fd
MG
110.SH BUGS
111None known so far.
ef6acdb8 112.SH AUTHOR
4205f1fd
MG
113Mikhail Gusarov <dottedmag@dottedmag.net>
114.SH AVAILABILITY
601d12fb
KZ
115The unshare command is part of the util-linux package and is available from
116ftp://ftp.kernel.org/pub/linux/utils/util-linux/.