Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Aug 2016 08:33:48 -0400
From:      Roger Pate <roger@qxxy.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: login.conf: tc overwrites setenv
Message-ID:  <CADTH-os9EMRubnJA6eRgUS%2B3cSoBYH6-7m9M0_RN6vAg5Eet3w@mail.gmail.com>
In-Reply-To: <20160826111512.GA70960@becker.bs.l>
References:  <20160826111512.GA70960@becker.bs.l>

next in thread | previous in thread | raw e-mail | index | archive | help
$ 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@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@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADTH-os9EMRubnJA6eRgUS%2B3cSoBYH6-7m9M0_RN6vAg5Eet3w>