Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For years I have had a problem with the "Setting locales failed". I now understood the problem. On my local machine, my LC_TIME is set to a custom file ("custom.UTF-8"). This custom file does not exist on any remote machine I connect to. However, through SSH my locale setting is 'exported' and searched for at the remote machine. So that is why I keep getting:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "custom.UTF-8",
    LANG = "en_US.UTF-8"

What I want to configure is that the local LC_TIME (or any locale variable) is never exported. I am fine just using the value defined at the remote machine. How should I define this?

share|improve this question
up vote 3 down vote accepted

The easiest way to prevent "exporting" the environment is to overwrite them on the server side. Create a .bashrc file (or the appropriate initialization file for your shell) and overwrite the variables.

example: minimal .bashrc file

unset LC_TIME

alternatively, set the variable to some sane value:

export LC_TIME=en_US.UTF-8

If you really want to prevent sending some environment variables then you will most likely need root access on the client and/or the server machine.

On the client side you can edit /etc/ssh/ssh_config and remove or alter the SendEnv line. Most distributions today have that set up to send the locale environment variables (LC_*). As user you can only append to this list, not overwrite. That is why you can only disable this option when you have root access to the machine.

Alternatively, on the server side you can edit /etc/ssh/sshd_config and remove or alter the AcceptEnv line. Most distributions today have that set up to accept the locale environment variables (LC_*).

Look up the explanations for SendEnv in the man page for ssh_config and AcceptEnv in the man page for sshd_config.

For the sake of completeness: there is also a PermitUserEnvironment in sshd_config. As the name says, it allows the user to set up some files which will initialize some variables. If PermitUserEnvironment is enabled you can take care of the rest as user, but I have never encountered a system with PermitUserEnvironment enabled.

share|improve this answer
As a user, you can override SendEnv in ~/.ssh/config. – lfaraone Jun 18 '13 at 20:21
AFAIK you cannot override SendEnv, you can only append to it. See – lesmana Jun 19 '13 at 13:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.