]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Do not switch to root for lxc-execute
authorPatrick Toomey <ptoomey3@biasedcoin.com>
Thu, 9 Jul 2015 22:58:17 +0000 (16:58 -0600)
committerPatrick Toomey <ptoomey3@biasedcoin.com>
Fri, 28 Aug 2015 14:24:11 +0000 (08:24 -0600)
Signed-off-by: Patrick Toomey <ptoomey3@biasedcoin.com>
src/lxc/start.c

index 6eded6155941e2a5c41ea1de4c58e2d62149a503..ce65e824332053f22311412ff5d26c7c9c1b0cef 100644 (file)
@@ -664,9 +664,10 @@ static int do_start(void *data)
 
        /*
         * if we are in a new user namespace, become root there to have
-        * privilege over our namespace
+        * privilege over our namespace. We don't become root for lxc-execute, as
+        * the intent is to execute a command as the original user.
         */
-       if (!lxc_list_empty(&handler->conf->id_map)) {
+       if (!handler->conf->is_execute && !lxc_list_empty(&handler->conf->id_map)) {
                NOTICE("switching to gid/uid 0 in new user namespace");
                if (setgid(0)) {
                        SYSERROR("setgid");