Hi,
I'm trying to 'ssh' into another machine, run a small script and fetch
it's output, using shell_exec(). The problem is, it takes AGES to run
ssh and I don't know what's happening. If I try 'ssh'ing manually on the
shell, it takes a microsecond to fetch the result, whereas shell_exec
takes very very long and I don't know how to debug the problem. That's
problem number one: How do I tell what's happening and why is it taking
so long?
Problem two: To be able to establish a password-less ssh connection, I
generated a public key/private key pair for the two machines and stored
it in my /home/username/.ssh directory. Okay, I know apache/php (by the
way I'm running apache with PHP 4.2.3) won't know where to find it so I
presumed /opt/apache/.ssh would be the best place to copy the ".ssh"
directory (i.e. apache's installed in /opt/apache). Now the problem is,
I couldn't get shell_exec to run ssh in a password less mode. After a
little while I realized that it was looking for the private key in
"/.ssh" (i.e. the root directory)! How come? How do I change it so that
it looks for the .ssh directory elsewhere? (I mean, how can I run a
command using shell_exec and ask it to use the "home" directory of the
"apache" user, which normally is /path/to/apache)? The last time I
installed php & apache, I remember it looked for the .ssh directory in
the /opt/apache/.ssh directory and now it has changed. also, it was much
faster the last time. Now for some reason it's EXTREMELY slow (takes a
whole minute to run ssh) and looks for the .ssh directory on the root
(and I dont want to place that directory there).
PLEASE HELP! Any suggestions would be great! Thanks,
Steve