Strange behaviour of ssh

Lukas Razik linux at razik.name
Tue Nov 8 00:38:17 EST 2011


Hello Philipp!

I see: I've done something strange - not ssh... :-/

Many thanks for the explanation!


Regards and have a nice day!
Lukas



Philipp Marek wrote:
>Hello Lukas!
>
>On Monday 07 November 2011, Lukas Razik wrote:
>> I've Debian 6.0.3 with OpenSSH_5.5p1 and problem with the execution of
>> remote commands via ssh.
>...
>> 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/ga
>> mes:/usr/games
>> 
>> So, does anyone of you have an idea what there could be wrong?
>yes. The ";" is parsed by the _local_ shell, ssh only transmits the first 
>part to the remote host - the rest is run locally.
>
>And "$PATH" is expanded locally, too - try with '$PATH'.
>
>
>To run multiple commands remotely you could try
>    ssh cluster2  /bin/sh -c 'mpirun ; mpirun ; which mpirun; echo $PATH'
>
>
>Regards,
>
>Phil


More information about the openssh-unix-dev mailing list