SSH issue

I want to run a program on remote server by using unauthenticated ssh. It works when I ssh from command line however, it does not work when I try to invoke ssh script with other application. Any clue?

When you call ssh or rsh or rexec or remsh with a command, there is no .profile run to build up environment, so invoke an environment script explicitly. Also, there is no tty, but that is less often the problem. Sometimes it is easiest to just invoke a shell, and send all the environment and commands down the pipe to it.

Thanks! "invoke an environment script explicitly? Do I have invoke env. script within the script that is using ssh ...?

 
echo '. ./.profile
...
' | ssh user_id@host_or_ip ksh

Thanks! I have unauthencticated SSH between these servers and tried this but did not work. Still complaining "can not open a file" which is already in the user path.

Well, sometimes you can use strace/truss/tusc to see what is happening, exactly. However, it tends to balk around set-uid and such. Make sure you are who you think you are, and where you think you are, or use an absolute path.

If your group says yes but your id says no, it is no, which some find surprising. More detail would help (id, ls -l, commands).

when I used absolute path, I am getting following error

TERM: Undefined variable
TERM: Undefined variable.
/usr/bin/.: Permission denied.