diff --git a/configure.ac b/configure.ac
index 090ee16b5..3fcf030c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -597,6 +597,7 @@ AC_CONFIG_FILES([
doc/lxc-unfreeze.sgml
doc/lxc-unshare.sgml
doc/lxc-user-nic.sgml
+ doc/lxc-usernsexec.sgml
doc/lxc-version.sgml
doc/lxc-wait.sgml
diff --git a/doc/Makefile.am b/doc/Makefile.am
index e87c2f8af..f5482383c 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -38,6 +38,7 @@ man_MANS = \
lxc-unfreeze.1 \
lxc-unshare.1 \
lxc-user-nic.1 \
+ lxc-usernsexec.1 \
lxc-version.1 \
lxc-wait.1 \
\
diff --git a/doc/lxc-usernsexec.sgml.in b/doc/lxc-usernsexec.sgml.in
new file mode 100644
index 000000000..dec18b920
--- /dev/null
+++ b/doc/lxc-usernsexec.sgml.in
@@ -0,0 +1,156 @@
+
+
+
+
+]>
+
+
+
+ @LXC_GENERATE_DATE@
+
+
+ lxc-usernsexec
+ 1
+
+
+
+ lxc-usernsexec
+
+
+ Run a task as root in a new user namespace.
+
+
+
+
+
+ lxc-unshare
+ -m uid-map
+ -- command
+
+
+
+
+ Description
+
+
+ lxc-usernsexec can be used to run a task as root
+ in a new user namespace.
+
+
+
+
+
+
+ Options
+
+
+
+
+
+
+
+
+
+ The uid map to use in the user namespace. Each map consists of
+ four colon-separate values. First a character 'u', 'g' or 'b' to
+ specify whether this map perttains to user ids, group ids, or
+ both; next the first userid in the user namespace; next the
+ first userid as seen on the host; and finally the number of
+ ids to be mapped.
+
+
+ More than one map can be specified. If no map is
+ specified, then by default the full uid and gid ranges granted
+ by /etc/subuid and /etc/subgid will be mapped to the
+ uids and gids starting at 0 in the container.
+
+
+ Note that lxc-usernsexec always tries
+ to setuid and setgid to 0 in the namespace. Therefore uid 0 in
+ the namespace must be mapped.
+
+
+
+
+
+
+
+
+
+
+ Examples
+
+ To spawn a shell with the full allotted subuids mapped into
+ the container, use
+
+ lxc-usernsexec
+
+ To run a different shell than /bin/sh, use
+
+ lxc-usernsexec -- /bin/bash
+
+
+
+ If your user id is 1000, root in a container is mapped to 190000, and
+ you wish to chown a file you own to root in the container, you can use:
+
+ lxc-usernsexec -m b:0:1000:1 -m b:1:190000:1 -- /bin/chown 1:1 $file
+
+ This maps your userid to root in the user namespace, and 190000 to uid 1.
+ Since root in the user namespace is privileged over all userids mapped
+ into the namespace, you are allowed to change the file ownership, which
+ you could not do on the host using a simple chown.
+
+
+
+ &seealso;
+
+
+ Author
+ Serge Hallyn serge.hallyn@ubuntu.com
+
+
+
+
+
diff --git a/src/lxc/lxc_usernsexec.c b/src/lxc/lxc_usernsexec.c
index 35cd4738b..83357259d 100644
--- a/src/lxc/lxc_usernsexec.c
+++ b/src/lxc/lxc_usernsexec.c
@@ -47,8 +47,7 @@ int unshare(int flags);
static void usage(const char *name)
{
- printf("usage: %s [-h] [-c] [-mnuUip] [-P ]"
- "[command [arg ..]]\n", name);
+ printf("usage: %s [-h] [-m ] -- [command [arg ..]]\n", name);
printf("\n");
printf(" -h this message\n");
printf("\n");