Bug: Environment vars are changed before use (locale LANG, LC_*)

Damien Miller djm at mindrot.org
Tue Mar 4 04:53:54 EST 2014


On Mon, 3 Mar 2014, Carsten Wieschiolek wrote:

> Hi Damien!
> 
> Thanks for the friendly reply!
> 
> I did a few more tests to investigate the matter further based on
> your comments. The bottom line is, that the settings from the file
> "environment" in the .ssh directory are not considered at all. The
> values from the calling SHELL have precedence over the entries in the
> file, which makes the file quite useless. Am I overlooking something
> important?

The order is something like:

1. Environment variables passed by SendEnv/AcceptEnv
2. Environment variables specified by pam_env
3. ~/.ssh/enviornment
4. Environment variables set by the shell

(I might have #2 and #3 reversed here)

#1, #2 and #3 all prepare the environment that the shell is executed with,
so naturally anything the shell does will overrride them. 

As for how to fix it. One way is to rename the environment variables
and then have your shell initialisation put them back. E.g.

preferred_LANG=en_AU:en

in ~/.ssh/enviornment, and

test -z "$preferred_LANG" && LANG="$preferred_LANG"
export LANG

in your shell initialisation.

-d


More information about the openssh-unix-dev mailing list