Set LANG On CentOS 6 Server

Home » CentOS » Set LANG On CentOS 6 Server
CentOS 2 Comments

Hi,

I’m having a weird problem on a CentOS 6 server. I installed the machine in french, so I have LANG=fr_FR.UTF8 defined.

I’d like to define en_US.UTF8, because some output is better readable in english, like chkconfig –list.

I replaced fr_FR.UTF8 in /etc/sysconfig/i18n and /boot/grub/grub.conf. Unfortunately, when I reboot the system, I still get this:

# echo $LANG
fr_FR.UTF-8

Any suggestions?

Niki

Microlinux – Solutions informatiques durables
7, place de l’église – 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32

2 thoughts on - Set LANG On CentOS 6 Server

  • Le 24/02/2018 à 10:33, Nicolas Kovacs a écrit :

    OK, so after some more googling, I found out that when I SSH into my server, LANG gets passed on from my desktop to my server. Interesting.

    So I just added the LANG definition to ~/.bashrc on the server to solve the problem.

    Cheers,

    Niki


    Microlinux – Solutions informatiques durables
    7, place de l’église – 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info@microlinux.fr Tél. : 04 66 63 10 32

  • Yes. If you look in /etc/ssh/sshd_config on the server there should be a list of environment variables that are accepted and in
    /etc/ssh/ssh_config on the client there should be a similar list of ones that are sent. (Actual location and name of the files depends on your particular distros.)

    A more elegant (dare I say proper) way of doing it is to create a
    ~/.ssh/config on your client and put in it a modified ‘SendEnv’ for that host (or don’t have a SendEnv if you don’t want any env variables sent).

    You can see what variables are being passed if you use the ‘-v’ option to SSH – and you can see if they are being accepted with ‘-vv’.

    You can also, if you want, modify sshd_config on the server to not accept the LANG and LC* variables.

    P.