On Thu, Mar 05, 2009 at 03:35:08PM -0700, Jialing Liang wrote: > There is no difference in login process for both version's sshd manual: > > LOGIN PROCESS > [...] > 6. Reads the file ~/.ssh/environment, if it exists, and > users > are allowed to change their environment. See the > PermitUserEnvironment option in sshd_config(5). > The fact is if I do a "real" login (ssh without command), server2 has > the variable be set: > > Localhost$ ssh server2 echo $LIC_HOST > Here, you can see evidence that it is NOT in fact reading ~/.ssh/environment. Compare with what I have: imadev:~/.ssh$ grep Environment /usr/local/etc/sshd_config PermitUserEnvironment yes imadev:~/.ssh$ cat environment JUBJUB=bandersnatch imadev:~/.ssh$ ssh localhost 'echo $JUBJUB' wooledg@localhost's password: bandersnatch > Localhost$ ssh server2 > $ hostname > server2 > $ cat $HOME/.kshrc > LIC_HOST=licserv; export LIC_HOST; > $ echo $LIC_HOST > licserv In this second example, you are running an actual Korn shell, which reads ~/.kshrc simply because it is a Korn shell -- not because it was told to by ~/.ssh/environment. (Actually this depends on the version of Korn shell. In ksh88, you must explicitly set ENV; in ksh93, ENV has a default value of $HOME/.kshrc if you don't set ENV. But you might also have set ENV=$HOME/.kshrc in your .profile which you haven't shown.) So, I still believe you've forgotten to set PermitUserEnvironment to yes.