Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 2 down vote accepted

The easiest way to "disable" the environment exporting 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=foo.UTF-8

If you really want to disable the sending of the environment variables then you will most likely need root access on the client 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_*). Sadly there is no way (that I know of) to disable or overwrite this as user.

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. But 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.

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 bugs.debian.org/cgi-bin/bugreport.cgi?bug=369401 –  lesmana Jun 19 '13 at 13:20
add comment

Your Answer


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