supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Bougy Man <tj@rubyists.com>
To: supervision@list.skarnet.org
Subject: Re: chpst -u and supplementary groups
Date: Mon, 19 Aug 2019 17:06:58 -0500	[thread overview]
Message-ID: <CA+cVzNX68TTNhSWA+Hwxp-7soK6G6TQAgMjpnE1dB5jsGX+ROg@mail.gmail.com> (raw)
In-Reply-To: <20190819120807.v4f2xe2mwjky3p2p@klumpi.ignorelist.com>

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

When I need this functionality, I generally use `groups=id -G|sed -e
's/\s/:/g'` then `chpst -u myuser:$groups` for the command line. This is
almost always just for processes I want to run as my own user, so it's a
rarity.

Tj

On Mon, Aug 19, 2019 at 7:08 AM Jan Braun <janbraun@gmx.de> wrote:

> Hello list!
>
> Yesterday, I spent way too much time chasing down a permissions problem
> caused by the fact that "chpst -u acc prog..." only sets the account's
> primary group, and ignores any supplementary groups the account may be a
> member of.
>
> TFM mentions "All initial supplementary groups are removed.", but I
> failed to memorize that. (Also, what does "initial" signify here?)
>
> My inability to see the issue came from the fact that all other similar
> programs (I'm aware of) do in fact add the supplementary groups. Watch:
>
> | # chpst -u test id
> | uid=1003(test) gid=1003(test) groups=1003(test)
> | # runuser -u test id
> | uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
> | # s6-setuidgid test id
> | uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
> | # su - test -c id
> | uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
> | # su test -c id
> | uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
> | # sudo -u test id
> | uid=1003(test) gid=1003(test) groups=1003(test),4(adm)
> | #
>
> So now I'm wondering:
> What are the use cases for not applying existing supplementary groups?
> Should chpst apply them by default?
> Should chpst grow an option to (not) apply them?
>     "chpst -u acc: prog..." is still free.
> Or is everything as it's supposed to be, and people might need to munge
>     the output of "getent initgroups acc" and feed it to the -u option?
>
> I'll be happy to try to come up with a patch (even if it's still a
> fatter warning in the manpage) if people can agree here what the right
> thing to do is.
>
> regards,
>     Jan
>

  parent reply	other threads:[~2019-08-19 22:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 12:08 Jan Braun
2019-08-19 19:33 ` Steve Litt
2019-08-19 22:06 ` Bougy Man [this message]
2019-08-20  7:25 ` Jonathan de Boyne Pollard
2019-08-20 10:04   ` Jan Braun
2019-08-20 18:21     ` Laurent Bercot
2019-08-21  3:50       ` Jan Braun
2019-08-20 18:25 ` Cameron Nemo
2019-08-21  3:22   ` Jan Braun
2019-08-21 22:26     ` Steve Litt
2019-08-27 23:44 Jeff

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=CA+cVzNX68TTNhSWA+Hwxp-7soK6G6TQAgMjpnE1dB5jsGX+ROg@mail.gmail.com \
    --to=tj@rubyists.com \
    --cc=supervision@list.skarnet.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;
as well as URLs for NNTP newsgroup(s).