I have an environment which uses hostbased authentication. From machine A,
with LOGNAME=quellyn, I can login as root on machine B. Unfortunately I lose
the value of LOGNAME=realuser in doing this.

I have tried this approach to passing environmental variables:

On Machine A (client-side), I have edited /etc/ssh/ssh_config and added the
following:

SendEnv LOGNAME

On Machine B (server-side), I have edited /etc/ssh/sshd_config and added the
following:

AcceptEnv LOGNAME

When I login from A to B, I can see that the variable is being passed correctly:

> debug1: Sending environment.
> debug3: Ignored env HOSTNAME
> debug3: Ignored env TERM
> debug3: Ignored env SHELL
> debug3: Ignored env HISTSIZE
> debug3: Ignored env SSH_CLIENT
> debug3: Ignored env SSH_TTY
> debug3: Ignored env USER
> debug3: Ignored env LS_COLORS
> debug3: Ignored env SUDO_USER
> debug3: Ignored env SUDO_UID
> debug3: Ignored env MAIL
> debug3: Ignored env PATH
> debug3: Ignored env INPUTRC
> debug3: Ignored env PWD
> debug3: Ignored env LANG
> debug3: Ignored env SSH_ASKPASS
> debug3: Ignored env KRB5CCNAME
> debug3: Ignored env SHLVL
> debug3: Ignored env HOME
> debug3: Ignored env SUDO_COMMAND
> debug1: Sending env LOGNAME = quellyn
> debug2: channel 0: request env confirm 0
> debug3: Ignored env CVS_RSH
> debug3: Ignored env SSH_CONNECTION
> debug3: Ignored env LESSOPEN
> debug3: Ignored env SUDO_GID
> debug3: Ignored env G_BROKEN_FILENAMES
> debug3: Ignored env _
> debug2: channel 0: request shell confirm 0
> debug2: fd 3 setting TCP_NODELAY
> debug2: callback done
> debug2: channel 0: open confirm rwindow 0 rmax 32768
> debug2: channel 0: rcvd adjust 131072
> Last login: Tue Sep 23 18:11:38 2008 from machine-a.local.com
>
> debug1: PAM: reinitializing credentials
> debug1: permanently_set_uid: 0/0
> debug3: Normalising mapped IPv4 in IPv6 address
> Environment:
> LOGNAME=root
> USER=root
> HOME=/root
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> MAIL=/var/mail/root
> SHELL=/bin/bash
> SSH_CLIENT=WWW.XXX.YYY.ZZZ 36906 22
> SSH_CONNECTION=WWW.XXX.YYY.ZZZ 36906 WWW.XXX.YYY.ZZY 22
> SSH_TTY=/dev/pts/7
> TERM=xterm
> debug3: channel 0: close_fds r -1 w -1 e -1 c -1
> [root@machine-b.local.com ~]#



From the server side I see that apparently it does see the variable:

> debug2: Setting env 0: LOGNAME=quellyn


Could anyone please help me to see why LOGNAME is not persisting? I'm not sure
if this is OpenSSH not being able to set the environment, or perhaps the login
process is superseding the variables I passed? Or perhaps I'm doing something
fundamentally wrong ...

Thank you!
Q.L. Snead