login.conf: tc overwrites setenv

Roger Pate roger at qxxy.com
Fri Aug 26 12:34:30 UTC 2016


$ ssh otherhost cat .login_conf
# $FreeBSD: releng/10.2/share/skel/dot.login_conf 77995 2001-06-10
17:08:53Z ache $
#
# see login.conf(5)
#
me:\
    :setenv=WASHERE=42:
$ ssh -t otherhost env | grep WASHERE
WASHERE=42

On Fri, Aug 26, 2016 at 7:15 AM, Bertram Scharpf
<lists at bertram-scharpf.de> wrote:
> 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
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list