Gentoo Archives: gentoo-user

From: Bertram Scharpf <lists@×××××××××××××××.de>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: [SOLVED] LC_ALL etc. not set when sshing into TMux
Date: Fri, 12 Aug 2016 10:31:15
Message-Id: 20160812103101.GA1420@becker.bs.l
In Reply to: [gentoo-user] LC_ALL etc. not set when sshing into TMux by Bertram Scharpf
1 On Thursday, 30. Jun 2016, 21:11:14 +0200, Bertram Scharpf wrote:
2 > [...] TMux [...], when I want
3 > to ssh into it I get the following message:
4 >
5 > $ ssh -t gentoohost tmux attach
6 > tmux: need UTF-8 locale (LC_CTYPE) but have ANSI_X3.4-1968
7 > Connection to gentoohost.mydomain.local closed.
8 >
9 > To find out what locale is set I wrote this little C
10 > program:
11 >
12 > int main(int argc, char **argv, char **env)
13 > {
14 > char **e;
15 > for (e = env; *e != 0; e++)
16 > printf( "%s\n", *e);
17 > return 0;
18 > }
19 >
20 > Then, after compiling,
21 >
22 > $ ssh -t gentoohost ./showenv | grep '^LC\|^LANG'
23 >
24 > this yields the empty result indeed. Therefore I guess
25 > TMux's behaviour is correct and the mistake is done by some
26 > ssh or login or whatsoever.
27 >
28 > The top (grandparent) sshd process has LC_ALL and LANG set
29 > with utf8, but the childs and grandchilds environments are
30 > empty.
31
32 I got hit by this yet another time when I tried to find out
33 why TMux's "mode-keys" option doesn't get set to "vi". This
34 depends on the EDITOR environment variable that is left
35 empty as well.
36
37 The solution is to set the environment variables by
38 "pam_env" which is called in "/etc/pam.d/sshd".
39
40 ---- /etc/pam.d/included_by_ssh---------------------------------
41 session required pam_env.so
42 ----------------------------------------------------------------
43
44 Append the following lines to the pam_env configuration:
45
46 ---- /etc/security/pam_env.conf --------------------------------
47 PAGER DEFAULT=less
48 EDITOR DEFAULT=vim
49 LANG DEFAULT=de_DE.UTF-8
50 LC_COLLATE DEFAULT=C
51 ----------------------------------------------------------------
52
53 Bertram
54
55
56 --
57 Bertram Scharpf
58 Stuttgart, Deutschland/Germany
59 http://www.bertram-scharpf.de