# /etc/login.conf has no effect or ignored?



## varda (Sep 28, 2021)

Hello Gentlemen.

I've updated /etc/login.conf as follow:

```
# cat /etc/login.conf
default:\
    :charset=UTF-8:\
    :lang=en_US.UTF-8:\
    :lc_all=en_US.UTF-8:\
    :passwd_format=sha512:\
...
...
root:\
    :ignorenologin:\
    :memorylocked=unlimited:\
    :tc=default:
...
```


```
# cap_mkdb -v /etc/login.conf
cap_mkdb: 9 capability records
```
Then logout and relogin again as root but still have no effect

```
# locale
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
```


```
uname -a
FreeBSD server.localnetwork 13.0-STABLE FreeBSD 13.0-STABLE #0: Sat Sep 18 03:50:56 +05 2021
root@server.localnetwork:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
```
Please point a direction


----------



## SirDice (Sep 28, 2021)

The variable is LC_ALL not lc_all, you don't set it like that in login.conf. Remove that line from login.conf. You only need to set `lang` and `charset` correctly. Also check if you don't have any locale settings in ~/.cshrc or a user ~/.login.conf that might override it.


----------



## T-Daemon (Sep 28, 2021)

Make sure there are no double entries. Your login.conf implies you have set at the beginning of the `default:\` login class, before `:passwd_format=sha512:\` those variables:



varda said:


> ```
> # cat /etc/login.conf
> default:\
> :charset=UTF-8:\
> ...



The default login.conf for stable/13 has `charset` and `lang` at the end of the `default:\` class set:

```
default:\
    ...
    :umask=022:\
    :charset=UTF-8:\
    :lang=C.UTF-8:
```
Also make sure the last entry has no backslash set.

Additional LC_* variables (except LC_ALL) can be set in the `:setenv=` line, for example you want different numbers or monetary formatting. setlocale(3)


----------



## varda (Sep 28, 2021)

Thanks for your replies Gentlemen.

But still no effect.  As T-Daemon said I've copied without modifications default login.conf from source distribution which is really has entries

```
:umask=022:\
:charset=UTF-8:\
:lang=C.UTF-8:
```
And then rebuild it. There is no /etc/profile file.  Also I've created new user with */bin/sh* shell and completely empty home dir, login as this user and got all the same

```
$ env
SSH_CLIENT=192.168.0.200 63184 22
LOGNAME=user
MAIL=/var/mail/user
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/user/bin:/some/path
PWD=/usr/home/user
TERM=xterm
SSH_TTY=/dev/pts/0
HOME=/home/user
USER=user
SSH_CONNECTION=192.168.0.200 63184 192.168.0.251 22
SHELL=/bin/sh
```


```
$ locale
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
```
I've added for test purpose */some/path* to *path=* entry and it appeared right but I even do not see specified at that login.conf file defined environment variable from *:setenv=BLOCKSIZE=K:\* entry

I also specially checked on 12.2-STABLE and everything works as expected. Can someone check on your 13 or current version?

Please advice.


----------



## T-Daemon (Sep 29, 2021)

SirDice said:


> Also check if you don't have any locale settings in ~/.cshrc or a user *~/.login.conf* that might override it.


Small typo there, name is separated by underscore: ~/.login_conf.


----------



## T-Daemon (Sep 29, 2021)

varda said:


> ```
> $ env
> SSH_CLIENT=192.168.0.200 63184 22
> ...
> ...


You didn't mention you are logging in remotely. Which ssh client are you using and what does `env` print when executed locally @server.localnetwork?


----------



## SirDice (Sep 29, 2021)

T-Daemon said:


> Small typo there, name is separated by underscore: ~/.login_conf.


Yes, I think I got confused with /etc/login.conf, muscle memory took over from there.


----------



## varda (Sep 30, 2021)

Gentlemen, thanks, your tips was helpful.

There was OpenSSH 8.8 on that box which it owner installed by hand himself, may be for test interest. It requires enabled `PermitUserEnvironment` in sshd_config and list variables which wanted to be exposed in users ~/.ssh/environment.  Then everything works as expected. I do not know why and how it aware about to set environment but version of sshd(8) supplied with FreeBSD works out of the box. 

If there is someone more experienced and can clarify how works or patched version in FreeBSD.

Thank You.


----------



## SirDice (Sep 30, 2021)

varda said:


> There was OpenSSH 8.8 on that box which it owner installed by hand himself, may be for test interest.


Then all bets are off. Not much we can help you with, it's non-standard, not part of the base. There's not even a port for it yet (security/openssh-portable is still on 8.7).


----------



## teo (Oct 1, 2021)

SirDice said:


> The variable is LC_ALL not lc_all, you don't set it like that in login.conf. Remove that line from login.conf. You only need to set `lang` and `charset` correctly. Also check if you don't have any locale settings in ~/.cshrc or a user ~/.login.conf that might override it.


Does the locale setting in ~/.cshrc or a user ~/.login.conf override the LC_ALL variable setting?


----------

