So you want a php script to launch an shell command, that shell command
being 'ssh', is that correct?
The apache launched process will always be owned by the apache process
unless you setuid, or use sudo to allow it to launch processes as other
users. I don't reccomend this.
You can call ssh differently. "/sbin/ssh -lusername hostname", I imagine
your trying to use your keys, correct? specify the keys also.
"/sbin/ssh -lusername -f identity hostname".
Now calling it from PHP all depends on what you want to do with it. You're
not going to be able to do interactive ssh sessions, so yo have to deciede
if you want to capture the output of your command, or just execute the
command and ignore the output. You can simulate interactivity via
http://us4.php.net/manual/en/function.proc-open.php
<?php
define('SSHCMD', '/sbin/sssh -l harrysacks -f
/home/harrysacks/.ssh/identity scrotum.org "/bin/ls /etc/hack"');
//Use popen, or backticks, your choice
$ssh = popen(SSHCMD, "r");
print fread($ssh, 4096);
pclose($ssh);
unset($ssh);
//or
$ssh = `SSHCMD`;
print $ssh;
?>
Good luck.
"Lorenza Soverini" <so******@cs.unibo.it> wrote in message
news:Pi**************************************@piso lo.cs.unibo.it...
Hi,
I'm a beginner with php and I've a problem using it from a web page.
I explain:
I need to establish an ssh connection from a web page. I've used
ssh.keygen for the authentication, that means that the user "lorenza" can
login without interactive ssh.
I've noticed that when I call a php script from a web page, it will be
executed from the "apache user".
now, the problem is that the ssh connection isn't established because the
user apache is not authorized and I've no possibility to authorize him
(administration problem).
anyone knows how can I establish an ssh connection to a remote host where
only the ssh port is opened, using php or something else, and
authenticating with a user different from apache??
Lorenza