Skip to content

Commit ecc64ce

Browse files
ahesfordflexibeast
authored andcommitted
lxc: Add section.
1 parent 78acce3 commit ecc64ce

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/config/lxc.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ configuration; simply use the various `lxc-*` commands, such as
1919

2020
### Creating unprivileged containers
2121

22-
The normal ranges of user IDs (UIDs) and group IDs (GIDs) are from 0 to 65535.
22+
User IDs (UIDs) and group IDs (GIDs) normally range from 0 to 65535.
2323
Unprivileged containers enhance security by mapping UID and GID ranges inside
24-
each container to ranges not in use by the host system. The host ranges must be
25-
*subordinated* to the user who will be running the unprivileged containers.
24+
each container to ranges not in use by the host system. The unused host ranges
25+
must be *subordinated* to the user who will be running the unprivileged
26+
containers.
2627

27-
Subordinate UIDs and GIDs are assigned by the
28+
Subordinate UIDs and GIDs are assigned in the
2829
[subuid(5)](https://man.voidlinux.org/subuid.5) and
2930
[subgid(5)](https://man.voidlinux.org/subgid.5) files, respectively.
3031

@@ -42,18 +43,20 @@ In each colon-delimited entry:
4243
- the second field is the smallest numeric ID defining a subordinate range; and
4344
- the third field is the number of consecutive IDs in the range.
4445

46+
The [usermod(8)](https://man.voidlinux.org/usermod.8) program may also be used
47+
to manipulate suborinated IDs.
48+
4549
Generally, the number of consecutive IDs should be an integer multiple of 65536;
4650
the starting value is not important, except to ensure that the various ranges
4751
defined in the file do not overlap. In this example, `root` controls UIDs (or,
4852
from `subgid`, GIDs) ranging from 1000000 to 1065535, inclusive; `user` controls
4953
IDs ranging from 2000000 to 2065535.
5054

5155
Before creating a container, the user owning the container will need an
52-
[lxc.conf(5)](https://man.voidlinux.org/lxc.conf.5) file, `default.conf`,
53-
specifying the subuid and subgid range to use. For root-owned containers, this
54-
file resides at `/etc/lxc/default.conf`; for unprivileged users, the file
55-
resides at `~/.config/lxc/default.conf`. Mappings are described in lines of the
56-
form
56+
[lxc.conf(5)](https://man.voidlinux.org/lxc.conf.5) file specifying the subuid
57+
and subgid range to use. For root-owned containers, this file resides at
58+
`/etc/lxc/default.conf`; for unprivileged users, the file resides at
59+
`~/.config/lxc/default.conf`. Mappings are described in lines of the form
5760

5861
```
5962
lxc.idmap = u 0 1000000 65536
@@ -68,7 +71,7 @@ seen from outside the container*, and may be an arbitrary value within the range
6871
delegated in `/etc/subuid` or `/etc/subgid`. The final value is the number of
6972
consecutive IDs to map.
7073

71-
**Note:** Although the external range start is arbitrary, care must be taken to
74+
Note that, although the external range start is arbitrary, care must be taken to
7275
ensure that the end of the range implied by the start and number does not extend
7376
beyond the range of IDs delegated to the user.
7477

@@ -97,9 +100,11 @@ containers.
97100
By default, configurations and mountpoints for system containers are stored in
98101
`/var/lib/lxc`, while configurations for user containers and mountpoints are
99102
stored in `~/.local/share/lxc`. Both of these values can be modified by setting
100-
`lxc.lxcpath` in the relevant `default.conf`. The superuser may launch
101-
unprivileged containers in the system `lxc.lxcpath`; regular users may launch
102-
unprivileged containers in their personal `lxc.lxcpath`.
103+
`lxc.lxcpath` in the
104+
[lxc.system.conf(5)](https://man.voidlinux.org/lxc.system.conf.5) file. The
105+
superuser may launch unprivileged containers in the system `lxc.lxcpath` defined
106+
in `/etc/lxc/lxc.conf`; regular users may launch unprivileged containers in the
107+
personal `lxc.lxcpath` defined in `~/.config/lxc/lxc.conf`.
103108

104109
All containers will share the same subordinate UID and GID maps by default. This
105110
is permissible, but it means that an attacker who gains elevated access within

0 commit comments

Comments
 (0)