On Thursday, 30. Jun 2016, 21:11:14 +0200, Bertram Scharpf wrote:
> [...] TMux [...], when I want
> to ssh into it I get the following message:
>
> $ ssh -t gentoohost tmux attach
> tmux: need UTF-8 locale (LC_CTYPE) but have ANSI_X3.4-1968
> Connection to gentoohost.mydomain.local closed.
>
> To find out what locale is set I wrote this little C
> program:
>
> int main(int argc, char **argv, char **env)
> {
> char **e;
> for (e = env; *e != 0; e++)
> printf( "%s\n", *e);
> return 0;
> }
>
> Then, after compiling,
>
> $ ssh -t gentoohost ./showenv | grep '^LC\|^LANG'
>
> this yields the empty result indeed. Therefore I guess
> TMux's behaviour is correct and the mistake is done by some
> ssh or login or whatsoever.
>
> The top (grandparent) sshd process has LC_ALL and LANG set
> with utf8, but the childs and grandchilds environments are
> empty.
I got hit by this yet another time when I tried to find out
why TMux's "mode-keys" option doesn't get set to "vi". This
depends on the EDITOR environment variable that is left
empty as well.
The solution is to set the environment variables by
"pam_env" which is called in "/etc/pam.d/sshd".
---- /etc/pam.d/included_by_ssh---------------------------------
session required pam_env.so
----------------------------------------------------------------
Append the following lines to the pam_env configuration:
---- /etc/security/pam_env.conf --------------------------------
PAGER DEFAULT=less
EDITOR DEFAULT=vim
LANG DEFAULT=de_DE.UTF-8
LC_COLLATE DEFAULT=C
----------------------------------------------------------------
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de