I have a debian server with locales set to hu_HU.UTF-8, and if i log in trough console it works perfectly in hungarian. It also worked with ssh logins until i disabled PAM in the sshd config. Since then when i log in trough ssh the locales are set to POSIX.

I tried to comment the AcceptEnv LANG LC_* line in sshd_config but the problem still exits. I'm connecting with Putty with UTF-8 character set.

So how can i fix this?

1 Answer 1


PuTTY doesn't set LANG

The locale you have set in PuTTY is completely decoupled from the environment variables on the system. To quote its documentation:

Unfortunately, there is no satisfactory mechanism for PuTTY and the server to communicate this information, so it must usually be manually configured.

Before PuTTY changed the default character encoding to UTF-8, it was an extremely common scenario for the OS to have settings defaulting to a UTF-8 enabled locale (typically en_US.UTF-8) with PuTTY misinterpreting that by its own ISO-8859-1:1998 default.

PAM is more than just authentication

More than likely you've turned UsePAM to no, not realizing that this turns off far more than just PAM authentication. The operative words from the sshd_config manpage are:

Enables the Pluggable Authentication Module interface. If set to “yes” this will enable PAM authentication using ChallengeResponseAuthentication and PasswordAuthentication in addition to PAM account and session module processing for all authentication types.

Your console logins are still invoking PAM modules associated with the account and session facilities, but your SSH logins are no longer doing so. I recommend that you re-enable PAM. At this point you can disable PasswordAuthentication and ChallengeResponseAuthentication if your goal is to require key based authentication. (which has always bypassed PAM's auth facility)

  • I was having the problem that /etc/default/locale wasn't taking effect on ssh login, this was resolved by changing UsePAM no to UsePAM yes. Thank you!
    – hcs
    Mar 7, 2022 at 5:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .