Linux-api Archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Richard Weinberger <richard@nod.at>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
	christian@brauner.io, ipedrosa@redhat.com, gscrivan@redhat.com,
	"Andreas Grünbacher" <andreas.gruenbacher@gmail.com>,
	acl-devel@nongnu.org, linux-man@vger.kernel.org,
	linux-api@vger.kernel.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	ebiederm <ebiederm@xmission.com>
Subject: Re: [PATCH 0/3] Document impact of user namespaces and negative permissions
Date: Wed, 13 Sep 2023 16:35:18 +0200	[thread overview]
Message-ID: <0e7962b0-4d66-4d86-b245-a695dd421d01@kernel.org> (raw)
In-Reply-To: <1972367750.1870193.1693344767957.JavaMail.zimbra@nod.at>


[-- Attachment #1.1: Type: text/plain, Size: 1640 bytes --]

Hi Richard,

On 2023-08-29 23:32, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
>> Von: "Alejandro Colomar" <alx@kernel.org>
>> Can you please provide a small shell session where this is exemplified?
> 
> Sure. I sent the following to the shadow maintainers privately on Friday,
> but since the issue is already known for years I don't hesitate to share.
> 
> # On a Debian Bookworm
> # So far no entries are installed.
> $ cat /etc/subuid
> 
> # useradd automatically does so.
> $ useradd -m rw
> $ cat /etc/subuid
> rw:100000:65536
> 
> # Let's create a folder where the group "nogames" has no permissions.
> $ mkdir /games
> $ echo win > /games/game.txt
> $ groupadd nogames
> $ chown -R root:nogames /games
> $ chmod 705 /games
> 
> # User "rw" must not play games
> $ usermod -G nogames rw
> 
> # Works as expected
> rw@localhost:~$ id
> uid=1000(rw) gid=1000(rw) groups=1000(rw),1001(nogames)
> rw@localhost:~$ cat /games/game.txt
> cat: /games/game.txt: Permission denied
> 
> # By using unshare (which utilizes the newuidmap helper) we can get rid of the "nogames" group.
> rw@localhost:~$ unshare -S 0 -G 0 --map-users=100000,0,65536 --map-groups=100000,0,65536 id
> uid=0(root) gid=0(root) groups=0(root)
> 
> rw@localhost:~$ unshare -S 0 -G 0 --map-users=100000,0,65536 --map-groups=100000,0,65536 cat /games/game.txt
> win
> 
> Thanks,
> //richard

Thanks!

Please include this in the commit message (at least for the Linux man-pages
one).

Cheers,
Alex

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2023-09-13 14:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 20:58 [PATCH 0/3] Document impact of user namespaces and negative permissions Richard Weinberger
2023-08-29 20:58 ` [PATCH 1/3] man: Document pitfall with negative permissions and user namespaces Richard Weinberger
2023-08-30  8:19   ` Christian Brauner
2023-08-29 20:58 ` [PATCH 2/3] user_namespaces.7: " Richard Weinberger
2023-08-29 21:32   ` Alejandro Colomar
2023-08-29 21:38     ` Alejandro Colomar
2023-08-29 21:40       ` Richard Weinberger
2023-08-29 21:39     ` Richard Weinberger
2023-08-29 21:40       ` Alejandro Colomar
2023-08-30  9:26     ` Alejandro Colomar
2023-08-30  8:18   ` Christian Brauner
2023-08-29 20:58 ` [PATCH 3/3] man: " Richard Weinberger
2023-08-30  8:19   ` Christian Brauner
2023-08-29 21:26 ` [PATCH 0/3] Document impact of user namespaces and negative permissions Alejandro Colomar
2023-08-29 21:32   ` Richard Weinberger
2023-09-13 14:35     ` Alejandro Colomar [this message]

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=0e7962b0-4d66-4d86-b245-a695dd421d01@kernel.org \
    --to=alx@kernel.org \
    --cc=acl-devel@nongnu.org \
    --cc=andreas.gruenbacher@gmail.com \
    --cc=christian@brauner.io \
    --cc=ebiederm@xmission.com \
    --cc=gscrivan@redhat.com \
    --cc=ipedrosa@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=serge@hallyn.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).