I have ssh login to two Linux - Openssh server. They share one $Home
directory. server1 runs Redhat 3 with Openssh 3.6.1 and sever2 runs
Redhat 5 with Openssh 4.3
The problem is: If I type "ssh server1 set" in a local host it shows
the variable defined in $HOME/.kshrc. However, "ssh server2 set" does
not show the variable defined in the same $HOME/.kshrc file. How can I
make the server2 works the same as server1? Here the user name in
local, svrever1 and server2 are the same.
Settings of both server1 and server2:
# cat /etc/ssh/sshd_config | grep PermitUserEnvironment
PermitUserEnvironment yes
$ cat $HOME/.ssh/environment
ENV=$HOME/.kshrc
$ cat $HOME/.kshrc
LIC_HOST=licserv; export LIC_HOST;
Results of ssh command:
localhost$ ssh server1 echo $LIC_HOST
licserv
localhost$ ssh server2 echo $LIC_HOST
Any workaround?
Thanks in advance for any discussions.
Jialing
I can't replicate this behavior with the named OpenSSH versions, but mine
are running on the same host (Debian). ksh is documented to only read
.kshrc when interactive, and that's the behavior I get. Perhaps the
difference is due to different versions of ksh, rather than OpenSSH?
--
Richard Silverman
r...@qoxp.net
The fact is if I do a "real" login (ssh without command), server2 has
the variable be set:
Localhost$ ssh server2
$ hostname
server2
$ cat $HOME/.kshrc
LIC_HOST=licserv; export LIC_HOST;
$ echo $LIC_HOST
licserv
However if do ssh with the commad, the .kshrc does not work (the
LIC_HOST is not set):
Localhost$ ssh server2 echo $LIC_HOST
So I guess when "ssh server2 command" is executed, the command is
running with the "default shell" instead of the "user's shell". The
server1 uses the "user's shell" for "ssh server1 command".
Jialing Liang
jialin...@cmgl.ca
Jialing Liang
jialin...@cmgl.ca
-----------------------
Do you have this in your .profile?
In ksh, the ENV variable names a file that will be
sourced for all ksh invocations.
This is set in ${HOME}/.profile, and then exported.
I have the following in ${HOME}/.profile:
ENV=${HOME}/.kshrc
export ENV
You might see if it helps.
Old Man
I have $HOME/.ssh/environment be set as:
$ cat $HOME/.ssh/environment
ENV=$HOME/.kshrc
And the ENV can be confirmed:
localhost$ ssh server2 echo $ENV
$HOME/.kshrc
It seems the "ssh server2 command" does not fully following the ksh
process. Actually, I can force the $HOME/.kshrc be read before the
command. That is:
localhost$ ssh server2 ". $HOME/.kshrc && echo $LIC_HOST"
licserv
That can a workaround but I am still seeking better solution.
Jialing Liang
jialin...@cmgl.ca