mirror_lxc/doc
Serge Hallyn f6d3e3e470 Implement userid mappings (enable user namespaces)
The 3.8 kernel now supporst uid mappings, so I believe it's appropriate
to proceed with this patchset.
The container config supports new entries of the form:
 lxc.id_map = U 100000 0 10000
 lxc.id_map = G 100000 0 10000
meaning map 'virtual' uids (in the container) 0-10000 to uids
100000-110000 on the host, and same for gids.  So long as there are
mappings specified in the container config, then CONFIG_NEWUSER will
be used when the container is cloned.  This means that container
setup is no longer done with root privilege on the host, only root
privilege in the container.  Therefore cgroup setup is moved from the
init task to the monitor task.

To use this patchset, you currently need to either use the raring
kernel at ppa:serge-hallyn/usern-natty, or build your own kernel
from either git://kernel.ubuntu.com/serge/quantal-userns.git.
(Alternatively you can use Eric's tree at the latest userns-always-map-*
branch at
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git
but you will likely want to at least enable tmpfs mounts in user namespaces)

You also need to chown the files in the container rootfs into the
mapped range.  There is a utility at
https://code.launchpad.net/~serge-hallyn/+junk/nsexec to do this.
uidmapshift does the chowning, while the container-userns-convert
script nicely wraps that program.  So I simply

	sudo lxc-create -t ubuntu -n r1
	sudo container-userns-convert r1 200000

will create a container which is shifted so uid 0 in the container
is uid 200000 on the host.

TODO: when doing setuid(0), need to only do that if 0 is one of the
ids we map to.  Similarly, when dropping capabilities, need to only
not do that if 0 is one of the ids we map to.  However, the question
of what to do for 'weird' containers in private user namespaces is
one I'm punting for later.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-01-15 12:09:33 -05:00
..
examples Change ipv4 addresses in the configuration examples 2012-07-31 16:01:22 +02:00
legacy Install legacy scripts when built without python. 2012-12-04 14:01:30 -05:00
rootfs Reinstate README file in rootfs directory 2012-11-12 13:47:51 -05:00
common_options.sgml.in update man pages about logpriority 2010-05-31 11:56:47 +02:00
FAQ.txt Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-attach.sgml.in Update documentation to Docbook 4.5 2012-11-12 15:20:39 -05:00
lxc-cgroup.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-checkpoint.sgml.in Update documentation to Docbook 4.5 2012-11-12 15:20:39 -05:00
lxc-console.sgml.in document lxc-console escape sequence and argument 2013-01-08 12:05:43 -05:00
lxc-create.sgml.in lxc-create: Support passing a full path to -t 2012-11-12 16:41:14 -05:00
lxc-destroy.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-execute.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-freeze.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-kill.sgml.in Update documentation to Docbook 4.5 2012-11-12 15:20:39 -05:00
lxc-ls.sgml.in Rewrite lxc-ls in python 2012-12-04 14:00:56 -05:00
lxc-monitor.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-ps.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-restart.sgml.in Update documentation to Docbook 4.5 2012-11-12 15:20:39 -05:00
lxc-shutdown.sgml.in Update documentation to Docbook 4.5 2012-11-12 15:20:39 -05:00
lxc-start.sgml.in separate console device from console log 2013-01-02 18:08:12 -05:00
lxc-stop.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-unfreeze.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc-wait.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc.conf Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
lxc.conf.sgml.in Implement userid mappings (enable user namespaces) 2013-01-15 12:09:33 -05:00
lxc.sgml.in Remove all trailing whitespaces. 2012-11-26 12:08:13 -05:00
Makefile.am Install legacy scripts when built without python. 2012-12-04 14:01:30 -05:00
see_also.sgml.in Add man page for lxc-attach 2012-02-23 09:57:14 +01:00