LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Strange behaviour of ssh (https://www.linuxquestions.org/questions/linux-software-2/strange-behaviour-of-ssh-912296/)

Consystor 11-07-2011 04:58 AM

Strange behaviour of ssh
 
Hello together!

I've Debian 6.0.3 and a problem with the execution of remote commands via ssh.
It seems as if the first command isn't looked up in all "$PATH" dirs.

Here normally I should get the version information of mpirun twice but the first one fails:
$ ssh cluster2 mpirun --version ; mpirun --version
bash: mpirun: command not found
mpirun (Open MPI) 1.4.3


Here I should get the place of "mpirun" twice but the first "which" doesn't find an "mpirun" and prints nothing:
$ ssh cluster2 which mpirun ; which mpirun
/usr/mpi/gcc/openmpi-1.4.3/bin/mpirun


The echo command prints the right "$PATH":
$ ssh cluster2 echo "$PATH"
/usr/mpi/gcc/openmpi-1.4.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


So, does anyone of you have an idea what there could be wrong?
And does anyone know which shell script is loaded remotely by ssh?
Is it .bashrc or .profile or another one?

Many thanks for any answer!

grail 11-07-2011 06:30 AM

I think you need to consider what the semi colon is doing in your command line??
You might be surprised by the results if you were to do:
Code:

$ ssh cluster2 echo mpirun --version num 1 ; echo mpirun --version num 2

Consystor 11-07-2011 07:40 AM

Hello and thanks for your answer!

I've done something stupid.
I should have write
ssh cluster2 'mpirun --version ; mpirun --version'

And
$ ssh cluster2 'echo $PATH'
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
instead of
$ ssh cluster2 "echo $PATH"
/usr/mpi/gcc/openmpi-1.4.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Regards

grail 11-07-2011 09:44 AM

If SOLVED please mark it as such :)


All times are GMT -5. The time now is 10:39 PM.