lxc-unshare.sgml.in revision 250b1eec71b074acdff1c5f6b5a1f0d7d2c20b77
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<!--
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbyelxc: linux Container library
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye(C) Copyright IBM Corp. 2007, 2008
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeAuthors:
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeDaniel Lezcano <daniel.lezcano at free.fr>
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeSerge Hallyn <serge.hallyn at ubuntu.com>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeThis library is free software; you can redistribute it and/or
38115c792a2142d264ca2617b11962301f079c0aTrond Norbyemodify it under the terms of the GNU Lesser General Public
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeLicense as published by the Free Software Foundation; either
38115c792a2142d264ca2617b11962301f079c0aTrond Norbyeversion 2.1 of the License, or (at your option) any later version.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeThis library is distributed in the hope that it will be useful,
38115c792a2142d264ca2617b11962301f079c0aTrond Norbyebut WITHOUT ANY WARRANTY; without even the implied warranty of
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeLesser General Public License for more details.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
3dc379d98a11243103242e2b43b1ab1322795b7eLubos KoscoYou should have received a copy of the GNU Lesser General Public
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeLicense along with this library; if not, write to the Free Software
38115c792a2142d264ca2617b11962301f079c0aTrond NorbyeFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco-->
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Kosco<!DOCTYPE refentry PUBLIC @docdtd@ [
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Kosco<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye]>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye<refentry>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <refmeta>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye <refentrytitle>lxc-unshare</refentrytitle>
b6e48c95305391ca75f99817def61159230969faTrond Norbye <manvolnum>1</manvolnum>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </refmeta>
cd1fe74964370b3f6b4ae79635fd1074f7a94d3dSven-Kristofer Pilz
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye <refnamediv>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye <refname>lxc-unshare</refname>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye <refpurpose>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye Run a task in a new set of namespaces.
cd1fe74964370b3f6b4ae79635fd1074f7a94d3dSven-Kristofer Pilz </refpurpose>
9a4361e23046cda58b9a5b8f4e11910dc433badaLubos Kosco </refnamediv>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye
760369283613b2d5c2449cdc5b7a74e16d929750Trond Norbye <refsynopsisdiv>
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Kosco <cmdsynopsis>
e8a20bc0a36e5885fa67503ba58be9c29ef96500Vladimir Kotal <command>lxc-unshare</command>
e8a20bc0a36e5885fa67503ba58be9c29ef96500Vladimir Kotal <arg choice="req">-s <replaceable>namespaces</replaceable></arg>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye <arg choice="req">-u <replaceable>user</replaceable></arg>
9f5a7adefcd3e07345b92f0deb1ed1c30df6eec2Trond Norbye <arg choice="req">command</arg>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye </cmdsynopsis>
760369283613b2d5c2449cdc5b7a74e16d929750Trond Norbye </refsynopsisdiv>
cd1fe74964370b3f6b4ae79635fd1074f7a94d3dSven-Kristofer Pilz
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <refsect1>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <title>Description</title>
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Kosco
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <para>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <command>lxc-unshare</command> can be used to run a task in a cloned set
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye of namespaces. This command is mainly provided for testing purposes.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye Despite its name, it always uses clone rather than unshare to create
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye the new task with fresh namespaces. Apart from testing kernel
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye regressions this should make no difference.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </para>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </refsect1>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <refsect1>
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Kosco
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <title>Options</title>
fcb68bae47907ba23c545e379c81c3ee6e19f778Lubos Kosco
4db6dbfe971f3c68c0945e5da3b6d5a3248054daTrond Norbye <variablelist>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <varlistentry>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <term>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <option>-s <replaceable>namespaces</replaceable></option>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </term>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <listitem>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <para>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye Specify the namespaces to attach to, as a pipe-separated list,
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye e.g. <replaceable>NETWORK|IPC</replaceable>. Allowed values are
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <replaceable>MOUNT</replaceable>, <replaceable>PID</replaceable>,
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <replaceable>UTSNAME</replaceable>, <replaceable>IPC</replaceable>,
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <replaceable>USER </replaceable> and
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <replaceable>NETWORK</replaceable>. This allows one to change
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye the context of the process to e.g. the network namespace of the
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye container while retaining the other namespaces as those of the
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye host.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </para>
cd1fe74964370b3f6b4ae79635fd1074f7a94d3dSven-Kristofer Pilz </listitem>
9a4361e23046cda58b9a5b8f4e11910dc433badaLubos Kosco </varlistentry>
cd1fe74964370b3f6b4ae79635fd1074f7a94d3dSven-Kristofer Pilz
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <varlistentry>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <term>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <option>-u <replaceable>user</replaceable></option>
4db6dbfe971f3c68c0945e5da3b6d5a3248054daTrond Norbye </term>
4db6dbfe971f3c68c0945e5da3b6d5a3248054daTrond Norbye <listitem>
4db6dbfe971f3c68c0945e5da3b6d5a3248054daTrond Norbye <para>
4db6dbfe971f3c68c0945e5da3b6d5a3248054daTrond Norbye Specify a user which the new task should become. This option is
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye only valid if a user namespace is unshared.
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </para>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </listitem>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye </varlistentry>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye </variablelist>
760369283613b2d5c2449cdc5b7a74e16d929750Trond Norbye
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye </refsect1>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye <refsect1>
38115c792a2142d264ca2617b11962301f079c0aTrond Norbye <title>Examples</title>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye <para>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye To spawn a new shell with its own UTS (hostname) namespace,
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco <programlisting>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye lxc-unshare -s UTSNAME /bin/bash
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco </programlisting>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye If the hostname is changed in that shell, the change will not be
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco reflected on the host.
e8a20bc0a36e5885fa67503ba58be9c29ef96500Vladimir Kotal </para>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye <para>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye To spawn a shell in a new network, pid, and mount namespace,
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye <programlisting>
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond Norbye lxc-unshare -s "NETWORK|PID|MOUNT" /bin/bash
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye </programlisting>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye The resulting shell will have pid 1 and will see no network interfaces.
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye After re-mounting /proc in that shell,
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye <programlisting>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye mount -t proc proc /proc
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco </programlisting>
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye ps output will show there are no other processes in the namespace.
dd1753e157524bbe2e69d24e75044962223191b4Pat Downey </para>
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco </refsect1>
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco &seealso;
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco <refsect1>
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco <title>Author</title>
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Kosco <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Kosco </refsect1>
ff5eba819da0cf7964d884630fb13262ef12c505Trond Norbye
e325ce06d9350834b2eab65f00334d7861354c61Lubos Kosco</refentry>
3aa0947feb67d3e8292d84776638be98dd97fdc3Lubos Kosco
e325ce06d9350834b2eab65f00334d7861354c61Lubos Kosco<!-- Keep this comment at the end of the file
e325ce06d9350834b2eab65f00334d7861354c61Lubos KoscoLocal variables:
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Koscomode: sgml
fcb68bae47907ba23c545e379c81c3ee6e19f778Lubos Koscosgml-omittag:t
fcb68bae47907ba23c545e379c81c3ee6e19f778Lubos Koscosgml-shorttag:t
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Koscosgml-minimize-attributes:nil
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Koscosgml-always-quote-attributes:t
dd1753e157524bbe2e69d24e75044962223191b4Pat Downeysgml-indent-step:2
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Koscosgml-indent-data:t
eb32a77fdb57f20c042b7b79b28a4fb4060cb949Lubos Koscosgml-parent-document:nil
a90c307564052f582357f820eadec4390e6a86c6Trond Norbyesgml-default-dtd-file:nil
a90c307564052f582357f820eadec4390e6a86c6Trond Norbyesgml-exposed-tags:nil
a90c307564052f582357f820eadec4390e6a86c6Trond Norbyesgml-local-catalogs:nil
a90c307564052f582357f820eadec4390e6a86c6Trond Norbyesgml-local-ecat-files:nil
5e0ccd8bb84a766f65680b4cc1e43b356d1d78b8Trond NorbyeEnd:
3dc379d98a11243103242e2b43b1ab1322795b7eLubos Kosco-->
a90c307564052f582357f820eadec4390e6a86c6Trond Norbye