Sep 11, 2015

Fix locale errors on an ssh connection from OSX

Today I was launching a new VPS to run my cloud instance of BTSync, and it happened that every new instance I launched gave me the same error, on both Ubuntu and Fedora.

This is the error I was getting on Ubuntu:

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

This is the error from Fedora:

Failed to set locale, defaulting to C

It turns out, the problem is that your terminal is sending the locales from your local machine to your remote server, and although I don't have nor know the techincal details, I do have the solution:

Edit /etc/ssh/sshd_config with your editor of choice and comment out the line beginning with AcceptEnv:

nano /etc/ssh/sshd_config

#AcceptEnv LANG LC_*

Once you do that, reboot your server (or the ssh daemon) and that should do it.


Updates

Comments