Phasing out forwarding of locale settings

Alexander E. Patrakov patrakov at
Fri Sep 10 01:51:25 AEST 2021

[resending after subscribing, sorry for the possible duplicate]
03.09.2021 20:02, Jochen.Bern at (Jochen Bern) пишет:
> On 03.09.21 11:55, Florian Weimer wrote:
>> Most distributions send locale environment variables by default:
> [...]
>> And accept them on the server side:
> [...]
>> Now that servers often use minimal installations which only support a
>> small set of locales (C, C.UTF-8), would it make sense to discontinue
>> this practice?
> In order to achieve what exactly?
> I'm no stranger to putting "export LANG=C" into shell scripts so that I
> can reliably parse command outputs, but on the other hand, our servers
> do document processing and some of the 3rd party software used will
> introduce strange misrepresentations unless we have both(!) en_US.UTF-8
> and de_DE.UTF-8 installed. Allowing the respective variables to be
> carried from client to server automatically keeps users from getting
> innovative with ~/.bashrc and the like ...

I would rather not forward the locale settings, and especially not 
accept them on the server side, and here is why.

More and more newbie Linux/cloud sysadmins use MacOS, not Linux, as 
their main system, and we have to deal with it. MacOS, by default, sends 
locale-related environment variables. Here is their default 
configuration in /etc/ssh/ssh_config, minus comments:

Host *
	SendEnv LANG LC_*

So, it will send locale-related environment variables. Here is the 
default environment on a Mac running Big Sur:


On Debian, the server-side configuration (minus comments) is as follows:

ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem	sftp	/usr/lib/openssh/sftp-server

So it accepts locale-related variables. Including this one:


But, this is valid on MacOS only. It is not a valid locale on Linux, and 
will never be. So, MacOS users that try to ssh to Debian systems will 
see locale errors (e.g. from Perl programs), and they often don't know 
why these errors appear and how to fix them. They would be better served 
by the Debian server applying its default locale settings. I even had to 
add some slides about this problem to my (proprietary and commercial) 
Linux sysadmin course, and would love to remove them.

Alexander E. Patrakov

More information about the openssh-unix-dev mailing list