Util-Linux package development
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: "U.Mutlu" <for-gmane@mutluit.com>
Cc: util-linux@vger.kernel.org
Subject: Re: unshare -m for non-root user
Date: Fri, 30 Oct 2015 11:22:47 +0100	[thread overview]
Message-ID: <20151030102247.GF19508@ws.net.home> (raw)
In-Reply-To: <n0ujgc$tll$1@ger.gmane.org>

On Fri, Oct 30, 2015 at 03:09:15AM +0100, U.Mutlu wrote:
> Hi,
> I wonder why "unshare -m" doesn't work for an unpriviledged user:
> 
> $ unshare -m /bin/bash
> unshare: unshare failed: Operation not permitted
> $ echo $?
> 1
> $ ls -l `which unshare`
> -rwxr-xr-x 1 root root 14640 Mar 30  2015 /usr/bin/unshare
> 
> Funny thing: when making the binary setuid then it works.
> But I would prefer a working original version in the OS repository.
> 
> OS: Debian 8
> 
> # dpkg -l | grep -i util-linux
> ii  util-linux                                 2.25.2-6            amd64
> Miscellaneous system utilities
> 
> Is this a bug, or is it not supposed to work for non-root users?

man 2 unshare:

CLONE_NEWNS

This  flag has the same effect as the clone(2) CLONE_NEWNS flag.
Unshare the mount namespace, so that the calling process has a private
copy of its namespace which is not shared with any other process.
Specifying this flag automatically implies CLONE_FS as well.  Use of
CLONE_NEWNS requires the CAP_SYS_ADMIN capability.
                         ^^^^^^^^^^^^

.. so yes, it's expected behavior.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2015-10-30 10:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30  2:09 unshare -m for non-root user U.Mutlu
2015-10-30 10:22 ` Karel Zak [this message]
2015-11-14  2:43   ` U.Mutlu
2015-11-14  3:53     ` Eric W. Biederman
2015-11-14  7:25       ` U.Mutlu
2015-11-14 18:17         ` Isaac Dunham
2015-11-14 21:07           ` U.Mutlu
2015-11-15  0:49             ` U.Mutlu
2015-11-15  1:24               ` Mike Frysinger
2015-11-15  2:10                 ` U.Mutlu
2015-11-15  6:28                   ` Mike Frysinger
2015-11-15 12:06                     ` U.Mutlu
2015-11-15 12:42                       ` Mike Frysinger
2015-11-15 15:56                         ` U.Mutlu
2015-11-15 18:49                           ` Mike Frysinger
2015-11-15 20:25                           ` Ángel González
2015-11-16  2:01                             ` U.Mutlu
2015-10-30 16:49 ` Mike Frysinger

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=20151030102247.GF19508@ws.net.home \
    --to=kzak@redhat.com \
    --cc=for-gmane@mutluit.com \
    --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