大网数据广告活动
服务器运维问答

locale not getting set correctly over ssh connection

· 52CE 我爱测

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 locale…

问题原文

原帖链接 · BubuIIC · CC BY-SA 3.0

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: http://wiki.debian.org/Locale. Now, when I login over ssh I still get the de_DE locale.

LANG=de_DE.utf8
LANGUAGE=de_DE.utf8
LC_CTYPE="de_DE.utf8"
LC_NUMERIC="de_DE.utf8"
LC_TIME="de_DE.utf8"
LC_COLLATE="de_DE.utf8"
LC_MONETARY="de_DE.utf8"
LC_MESSAGES="de_DE.utf8"
LC_PAPER="de_DE.utf8"
LC_NAME="de_DE.utf8"
LC_ADDRESS="de_DE.utf8"
LC_TELEPHONE="de_DE.utf8"
LC_MEASUREMENT="de_DE.utf8"
LC_IDENTIFICATION="de_DE.utf8"
LC_ALL=de_DE.utf8

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...

已采纳解答

原帖链接 · BubuIIC · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-01-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。