[Pkg-shadow-devel] [PATCH] su(1): document PATH handling when --preserve-environment

Nicolas François nicolas.francois at centraliens.net
Thu Jun 4 20:50:36 UTC 2009


Hello,

On Sun, May 31, 2009 at 12:37:39AM -0400, vapier at gentoo.org wrote:
>
> -	  <para>Preserve the current environment.</para>
> +	  <para>
> +	    Preserve the current environment (except for <envar>$PATH</envar>
> +	    as that is still reset per the configuration).
> +	  </para>

I took the opportunity to document other environment variables handling:

==  PAM version  ============================================================
       -m, -p, --preserve-environment
           Preserve the current environment, except for:

           $PATH
               reset according to the /etc/login.defs options ENV_PATH or
               ENV_SUPATH (see below);

           $IFS
               reset to “<space><tab><newline>”, if it was set.

           If the target user has a restricted shell, this option has no
           effect (unless su is called by root).

           Note that the default behavior for the environment is the
           following:

               The $HOME, $SHELL, $USER, $LOGNAME, $PATH, and $IFS environment
               variables are reset.

               If --login is used, the $TERM, $COLORTERM, $DISPLAY, and
               $XAUTHORITY environment variables are kept if they were set.

               Other environment variables are deleted, but might be set by
               PAM modules.
=============================================================================


==  non PAM version  ========================================================
       -m, -p, --preserve-environment
           Preserve the current environment, except for:

           $PATH
               reset according to the /etc/login.defs options ENV_PATH or
               ENV_SUPATH (see below);

           $IFS
               reset to “<space><tab><newline>”, if it was set.

           If the target user has a restricted shell, this option has no
           effect (unless su is called by root).

           Note that the default behavior for the environment is the
           following:

               The $HOME, $SHELL, $USER, $LOGNAME, $PATH, and $IFS environment
               variables are reset.

               If --login is used, the $TERM, $COLORTERM, $DISPLAY, and
               $XAUTHORITY environment variables are kept if they were set.

               If --login is used, the $TZ, $HZ, and $MAIL environment
               variables are set according to the /etc/login.defs options
               ENV_TZ, ENV_HZ, MAIL_DIR, and MAIL_FILE (see below).

               Other environment variables are deleted, but might be set by
               the ENVIRON_FILE file (see below).
=============================================================================

Best Regards,
-- 
Nekral



More information about the Pkg-shadow-devel mailing list