login.conf: tc overwrites setenv

Bertram Scharpf lists at bertram-scharpf.de
Fri Aug 26 11:20:29 UTC 2016


Hi,

when I enter a displayless machine I want to start TMux
immediately:

  $ ssh -t otherhost tmux -u

Yet, this bypasses /etc/profile before the TMux server is
started. As soon as TMux opens its first pane, a shell is
opened and /etc/profile comes into respect. But while TMux
is setting up its mode-keys option, it won't detect the
EDITOR=vi in the profile. Therefore I added the EDITOR
environment variable to /etc/login.conf.

default:\
	:setenv=[...],EDITOR=vi:\
        :[...]:

This works as long as I only use the "default" section.
However, when I change the login class in vipw to "german"
the effect disappears.

german|German Users Accounts:\
	:charset=UTF-8:\
	:lang=de_DE.UTF-8:\
	:setenv=LC_COLLATE=C:\
	:tc=default:

The tc directive imports all directives from "default" but
then, "setenv" is overwritten.

I thorougly examined this behaviour by setting further
environment variables and by not calling TMux but a simple
variable dump (see below).

Is there a way to merge the setenv directives?

Is there any better solution to my problem? On a Linux
machine I solved it by calling pam_env in /etc/pam.d/sshd
<http://www.gossamer-threads.com/lists/gentoo/user/315647#316921>,
but I can find no pam_env in FreeBSD.

Thanks in advance.

Bertram


________________________________________________________________
In /etc/login.conf:

default:\
	:setenv=[...],EDITOR=vi,WASHERE_DEFAULT=x:\
        :[...]:

german|German Users Accounts:\
	:charset=UTF-8:\
	:lang=de_DE.UTF-8:\
	:setenv=LC_COLLATE=C,WASHERE_GERMAN=x:\
	:tc=default:

--<showenv.c>---------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv, char **env)
{
    char **e;

    for (e = env; *e != 0; e++)
        printf( "%s\n", *e);    
    return 0;
}
----------------------------------------------------------------

Shell command:

  $ ssh -t otherhost ./showenv | grep ^WASHERE



-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de


More information about the freebsd-questions mailing list