0

When I connect to my Linux server (Ubuntu 14.04) using putty I have some problems because the SSH-connection always uses ANSI_X3.4-1968 as charset (output of locale charmap).

However my system is configured to use de_DE.UTF-8 which can be seen by cat /etc/default/locale:

LANG=de_DE.UTF-8
LC_MESSAGES=POSIX

The used connection profile of putty uses UTF-8 as Remote character set (Window -> Translation). I also tried to use the value de_DE.UTF-8 here, but there was no change.

The strange thing is that when I log in on the physical console an execute locale charmap there I get the correct and expected result: UTF-8.

Why do I get different configured charsets using Putty (v0.67) and the physical console? Is this therefore a putty configuration problem, or is the problem on the linux server side?

Update 1:

I also compared the /etc/pam.d/sshd with one from a second similar server that is not affected by this problem and both files were identical. The same is true for the file /etc/ssh/ssh_config (both files contain the line SendEnv LANG LC_*).

I also executed the following commands to make sure the locales are not defect:

sudo locale-gen --purge
sudo update-locale LANG=de_DE.UTF-8
2

This has nothing to do with PuTTY. What you've configured there is only the terminal character set, which tells PuTTY how to decode the text it receives – but doesn't pass it to the server in any way.

The locale settings ($LANG &c.) are loaded by the server itself – depending on the distro, either by source-ing /etc/default/locale from the shell's startup file (e.g. from /etc/profile), or by loading it via PAM using the pam_env module.

Grep your PAM configurations in /etc/pam.d for mentions of /etc/default/locale.

  • If you find a matching pam_env line directly in an app config such as /etc/pam.d/login, copy it to roughly the same place in /etc/pam.d/sshd. (Pay attention to where in the stack it's located.)

  • If you find a matching line in the shared common-session config, then make sure the sshd PAM configuration imports it (e.g. via @include common-session).

  • If you don't find anything in PAM, check the shell's startup files instead.

|improve this answer|||||
  • Thanks for the answer. I learned a lot, unfortunately it did not solve my problem (see updated question). – Robert Sep 9 '16 at 8:32
  • You've compared /etc/pam.d/sshd, but have you compared the other files? – user1686 Sep 9 '16 at 8:32
  • Just made an md5sum of /etc/pam.d/* and they are identical on both servers. But I found the important difference. It was /etc/ssh/sshd_config. Looks like someone removed important lines from it. – Robert Sep 9 '16 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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