Debian Codegraph @

doc/lxc-usernsexec.sgml.in

raw
1 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
2
3 <!DOCTYPE refentry PUBLIC @docdtd@ [
4
5 <!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
6 <!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
7 ]>
8
9 <refentry>
10
11 <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
12
13 <refmeta>
14 <refentrytitle>lxc-usernsexec</refentrytitle>
15 <manvolnum>1</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>lxc-usernsexec</refname>
20
21 <refpurpose>
22 Run a task as root in a new user namespace.
23 </refpurpose>
24 </refnamediv>
25
26 <refsynopsisdiv>
27 <cmdsynopsis>
28 <command>lxc-usernsexec</command>
29 <arg choice="opt">-m <replaceable>uid-map</replaceable></arg>
30 <arg choice="req">-- command</arg>
31 </cmdsynopsis>
32 </refsynopsisdiv>
33
34 <refsect1>
35 <title>Description</title>
36
37 <para>
38 <command>lxc-usernsexec</command> can be used to run a task as root
39 in a new user namespace.
40 </para>
41
42 </refsect1>
43
44 <refsect1>
45
46 <title>Options</title>
47
48 <variablelist>
49
50 <varlistentry>
51 <term>
52 <option>-m <replaceable>uid-map</replaceable></option>
53 </term>
54 <listitem>
55 <para>
56 The uid map to use in the user namespace. Each map consists of
57 four colon-separate values. First a character 'u', 'g' or 'b' to
58 specify whether this map pertains to user ids, group ids, or
59 both; next the first userid in the user namespace; next the
60 first userid as seen on the host; and finally the number of
61 ids to be mapped.
62 </para>
63 <para>
64 More than one map can be specified. If no map is
65 specified, then by default the full uid and gid ranges granted
66 by /etc/subuid and /etc/subgid will be mapped to the
67 uids and gids starting at 0 in the container.
68 </para>
69 <para>
70 Note that <replaceable>lxc-usernsexec</replaceable> always tries
71 to setuid and setgid to 0 in the namespace. Therefore uid 0 in
72 the namespace must be mapped.
73 </para>
74 </listitem>
75 </varlistentry>
76
77
78 </variablelist>
79
80 </refsect1>
81
82 <refsect1>
83 <title>Examples</title>
84 <para>
85 To spawn a shell with the full allotted subuids mapped into
86 the container, use
87 <programlisting>
88 lxc-usernsexec
89 </programlisting>
90 To run a different shell than <replaceable>/bin/sh</replaceable>, use
91 <programlisting>
92 lxc-usernsexec -- /bin/bash
93 </programlisting>
94 </para>
95 <para>
96 If your user id is 1000, root in a container is mapped to 190000, and
97 you wish to chown a file you own to root in the container, you can use:
98 <programlisting>
99 lxc-usernsexec -m b:0:1000:1 -m b:1:190000:1 -- /bin/chown 1:1 $file
100 </programlisting>
101 This maps your userid to root in the user namespace, and 190000 to uid 1.
102 Since root in the user namespace is privileged over all userids mapped
103 into the namespace, you are allowed to change the file ownership, which
104 you could not do on the host using a simple chown.
105 </para>
106 </refsect1>
107
108 &seealso;
109
110 </refentry>
111
112 <!-- Keep this comment at the end of the file
113 Local variables:
114 mode: sgml
115 sgml-omittag:t
116 sgml-shorttag:t
117 sgml-minimize-attributes:nil
118 sgml-always-quote-attributes:t
119 sgml-indent-step:2
120 sgml-indent-data:t
121 sgml-parent-document:nil
122 sgml-default-dtd-file:nil
123 sgml-exposed-tags:nil
124 sgml-local-catalogs:nil
125 sgml-local-ecat-files:nil
126 End:
127 -->