util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Bernhard Voelker <mail@bernhard-voelker.de>
Cc: Bruce Dubbs <bruce.dubbs@gmail.com>, util-linux@vger.kernel.org
Subject: Re: su(1) --whitelist-environment
Date: Tue, 14 Aug 2018 11:32:57 +0200	[thread overview]
Message-ID: <20180814093257.nglcor4c3jagjyxv@ws.net.home> (raw)
In-Reply-To: <745f75b6-d849-a519-7855-9de62d999e06@bernhard-voelker.de>

On Mon, Aug 13, 2018 at 10:57:01PM +0200, Bernhard Voelker wrote:
> On 08/10/2018 11:06 PM, Bruce Dubbs wrote:
> > I think it is unnecessary.  su itself does not need the environment 
> > variable.  If a user needs a specific setting, then set it in a script:
> > 
> > su --command myscript

The important is to say that reset environment is good, expected and
wanted thing. You want to have full control on environment in many
cases.

> I'm 50:50.  The point was to pass in variables values per environment
> to a process inside 'su' (or 'sudo'), and one can achieve that with e.g.

BTW, sudo has env_check, env_delete, or env_keep to control environment
in the sudoers.

>   $ su -c 'env VAR="val" myscript' user
> 
> Well, this might become slightly trickier with real shell or environment
> variables wrt/ correct shell quoting:
> 
>   $ VAR='some value'
>   $ su -c 'env VAR="'"$VAR"'" myscript' user

Well, probably usable way for scripts, but ugly for users on command line.

All the idea behind the patch is make things more user-friendly

    su -w GREP_COLOR,COLORFGBG - kzak

seems better than assume -c 'env VAR ..."

    Karel

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

  reply	other threads:[~2018-08-14 12:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  9:24 su(1) --whitelist-environment Karel Zak
2018-08-10 21:06 ` Bruce Dubbs
2018-08-13 20:57   ` Bernhard Voelker
2018-08-14  9:32     ` Karel Zak [this message]
2018-08-14 10:47       ` Martin Steigerwald
2018-08-14 12:50       ` Bernhard Voelker
2018-08-15 11:04         ` 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=20180814093257.nglcor4c3jagjyxv@ws.net.home \
    --to=kzak@redhat.com \
    --cc=bruce.dubbs@gmail.com \
    --cc=mail@bernhard-voelker.de \
    --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;
as well as URLs for NNTP newsgroup(s).