From: bobtfish@bobtfish.net
To: util-linux@vger.kernel.org
Cc: Tomas Doran <bobtfish@bobtfish.net>
Subject: [PATCH] Setting uid / gid is generally useful in nseneter
Date: Sat, 26 Jul 2014 13:22:54 -0700 [thread overview]
Message-ID: <1406406174-20938-1-git-send-email-bobtfish@bobtfish.net> (raw)
From: Tomas Doran <bobtfish@bobtfish.net>
It's useful to be able to set the UID/GID even when not using user namespaces
(for example when creating a non-root shell in a pre-existing docker container)
Signed-off-by: Tomas Doran <bobtfish@bobtfish.net>
---
sys-utils/nsenter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/nsenter.c b/sys-utils/nsenter.c
index d57edc8..23798f9 100644
--- a/sys-utils/nsenter.c
+++ b/sys-utils/nsenter.c
@@ -328,7 +328,7 @@ int main(int argc, char *argv[])
if (do_fork == 1)
continue_as_child();
- if (namespaces & CLONE_NEWUSER) {
+ if (uid > 0 || gid > 0) {
if (setgroups(0, NULL)) /* drop supplementary groups */
err(EXIT_FAILURE, _("setgroups failed"));
if (setgid(gid) < 0)
--
2.0.1
next reply other threads:[~2014-07-26 20:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-26 20:22 bobtfish [this message]
2014-07-28 11:56 ` [PATCH] Setting uid / gid is generally useful in nseneter Karel Zak
2014-07-28 19:24 ` Eric W. Biederman
2014-07-29 11:23 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406406174-20938-1-git-send-email-bobtfish@bobtfish.net \
--to=bobtfish@bobtfish.net \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox