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

I have a debian server with several locales installed, de_DE, en_GB and en_US. I want to be able to login over ssh and get the locale set accordingly (to en_US in my case, different for someone else) I ran dpkg-reconfigure locales, and selected None as the default locale as mentioned here: Now, when I login over ssh I still get the de_DE locale.


I checked with ssh -v, the ssh client is indeed sending the LANG variable

debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8

How is the locale still getting set to DE and how can I disable that behavior?

Edit: It works now. Someone forcibly set the locale in /etc/profile...

share|improve this question

Is specifying the user-preferred locale configurations in ~/.profile appropriate for your needs?

Also, to save you the annoyance, stop forwarding locale from your client (/etc/ssh/ssh_config, comment out SendEnv LANG...) and stop accepting on the server (/etc/ssh/sshd_config)..

Or, if you prefer, you can set a ~/.ssh/environment file with the options you want. You'll have to enable PermitUserEnvironment on the server's /etc/ssh/sshd_config file.

share|improve this answer
I think the forwarding of the locale is not the problem, I actually want that to work. The server not accepting or rather not setting the locale accordingly is the problem. Setting it explicitly in .profile would work. But I was wondering where the system still gets the German locale from. – BubuIIC Jan 11 '13 at 21:44
up vote 1 down vote accepted

Ok, I figured it out. Someone hard coded the LC_ALL and LANG variables in /etc/profile, so everything else was just ignored. After removing these, the locale now gets set according to the environment transmitted by ssh.

share|improve this answer

In my case when logging in with ssh none of the usual default locale or environment variable settings seemed to work. It was because I had disabled PAM session control in sshd configuration.

Make sure you have set

UsePAM yes 

in your /etc/ssh/sshd_config file, at least this worked for me.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.