3 lxc: linux Container library
5 (C) Copyright IBM Corp. 2007, 2008
8 Daniel Lezcano <daniel.lezcano at free.fr>
9 Serge Hallyn <serge.hallyn at ubuntu.com>
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 2.1 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 <!DOCTYPE refentry PUBLIC @docdtd@ [
29 <!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
30 <!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
35 <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
38 <refentrytitle>lxc-unshare</refentrytitle>
39 <manvolnum>1</manvolnum>
43 <refname>lxc-unshare</refname>
46 Run a task in a new set of namespaces.
52 <command>lxc-unshare</command>
53 <arg choice="req">-s <replaceable>namespaces</replaceable></arg>
54 <arg choice="req">-u <replaceable>user</replaceable></arg>
55 <arg choice="req">command</arg>
60 <title>Description</title>
63 <command>lxc-unshare</command> can be used to run a task in a cloned set
64 of namespaces. This command is mainly provided for testing purposes.
65 Despite its name, it always uses clone rather than unshare to create
66 the new task with fresh namespaces. Apart from testing kernel
67 regressions this should make no difference.
74 <title>Options</title>
80 <option>-s <replaceable>namespaces</replaceable></option>
84 Specify the namespaces to attach to, as a pipe-separated list,
85 e.g. <replaceable>NETWORK|IPC</replaceable>. Allowed values are
86 <replaceable>MOUNT</replaceable>, <replaceable>PID</replaceable>,
87 <replaceable>UTSNAME</replaceable>, <replaceable>IPC</replaceable>,
88 <replaceable>USER </replaceable> and
89 <replaceable>NETWORK</replaceable>. This allows one to change
90 the context of the process to e.g. the network namespace of the
91 container while retaining the other namespaces as those of the
99 <option>-u <replaceable>user</replaceable></option>
103 Specify a user which the new task should become. This option is
104 only valid if a user namespace is unshared.
114 <title>Examples</title>
116 To spawn a new shell with its own UTS (hostname) namespace,
118 lxc-unshare -s UTSNAME /bin/bash
120 If the hostname is changed in that shell, the change will not be
121 reflected on the host.
124 To spawn a shell in a new network, pid, and mount namespace,
126 lxc-unshare -s "NETWORK|PID|MOUNT" /bin/bash
128 The resulting shell will have pid 1 and will see no network interfaces.
129 After re-mounting /proc in that shell,
131 mount -t proc proc /proc
133 ps output will show there are no other processes in the namespace.
140 <title>Author</title>
141 <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
146 <!-- Keep this comment at the end of the file
151 sgml-minimize-attributes:nil
152 sgml-always-quote-attributes:t
155 sgml-parent-document:nil
156 sgml-default-dtd-file:nil
157 sgml-exposed-tags:nil
158 sgml-local-catalogs:nil
159 sgml-local-ecat-files:nil