[sudo-users] Letting just selected environment variables through

Todd C. Miller Todd.Miller at courtesan.com
Tue Aug 1 14:04:39 MDT 2017


On Mon, 31 Jul 2017 11:24:14 -0000, "R. Diez" wrote:

> I think sudo should provide a command-line argument to specify which
> environment variables to let through, so that you do not need to
> expose their contents in the command line, or let them all through.

That seems reasonable to me.  We could modify the --preserve-env
option to take an optional list of variables to preserve.  E.g.

    sudo --preserve-env=VAR1,VAR2,VAR2 some command ...

Used like that it would only preserve the specified variables.  If
no variables are specified, --preserve-env would behave as it does
now.

Sound good?

 - todd


More information about the sudo-users mailing list