Score:0

locale shows different settings for root user

us flag

I'm confused about the locale settings on my system. I have an Ubuntu 20.04.3 server that I connect to via Putty.

I'm root on the system (I know. Stupid idea. But I'm just setting this up and then I don't do it anymore when I'm done.). When I run the locale and sudo locale commands on the system I get different results and I have no idea where this is coming from.

Result with locale:

# Results in
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

Result with sudo locale:

# Results in
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

I have tried to reconfigure this with sudo sudo dpkg-reconfigure locales but it didn't work.

The /etc/default/locale file looks as follows:

LANG=de_DE.UTF-8

If I log in as another user all is fine.

Can anyone give me a hint as to what I am doing wrong here?

Thanks in advance for any help.

rɑːdʒɑ avatar
ph flag
What is the output of `locale -a | grep en_US`
us flag
The output of ```locale -a | grep en_US``` is ```en_US.utf8``` and for ```locale -a | grep de_DE``` is ```de_DE.utf8``` because i want to setup for german.
hr flag
When you use `sudo`, it is likely enforcing the locale via PAM (`/etc/pam.d/sudo`). When you log in via SSH, it *should* do something similar (via `/etc/pam.d/session` ?) and *may* permit `LC_*` variables to be overwritten by the client - I don't know why that would be different for root versus non-root SSH though, unless your SSH config is applying different setups (perhaps via a `match` block)
tripleee avatar
nz flag
Each account is able to override the locale settings. Changing the system default will not change anything for an account which overrides the system default anyway. Perhaps [edit] to show whather, and if so how, these accounts do that from their shell startup scipts, GUI settings, and/or etc.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.