How to fix ssh locale issues on Linux

So you ssh into your server and all over the place you see something like

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

You search for the solution and everywhere keeps telling you to setup the locales but nothing works. Most likely what the problem is your ssh client is forwarding its locale-related environment variables and thats messing up stuff on the server end. To fix.

Edit /etc/ssh/ssh_config and comment out the line that says

SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES

Save, and restart your ssh service (or just restart)

You may also like...

Leave a Reply