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

varda

Active Member

Reaction score: 27
Messages: 124

Hello Gentlemen.

I've updated /etc/login.conf as follow:
Code:
# 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:
...
Code:
# cap_mkdb -v /etc/login.conf
cap_mkdb: 9 capability records
Then logout and relogin again as root but still have no effect
Code:
# locale
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
Code:
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

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,685
Messages: 39,278

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

Daemon

Reaction score: 929
Messages: 1,816

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:

Code:
# cat /etc/login.conf
default:\
    :charset=UTF-8:\
    :lang=en_US.UTF-8:\
    :lc_all=en_US.UTF-8:\
    :passwd_format=sha512:\
    ...

The default login.conf for stable/13 has charset and lang at the end of the default:\ class set:
Code:
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)
 
OP
V

varda

Active Member

Reaction score: 27
Messages: 124

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
Code:
: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
Code:
$ 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
Code:
$ 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

Daemon

Reaction score: 929
Messages: 1,816

Code:
$ env
SSH_CLIENT=192.168.0.200 63184 22
...
SSH_TTY=/dev/pts/0
...
SSH_CONNECTION=192.168.0.200 63184 192.168.0.251 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?
 
OP
V

varda

Active Member

Reaction score: 27
Messages: 124

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

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,685
Messages: 39,278

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

Aspiring Daemon

Reaction score: 42
Messages: 704

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?
 
Top