Hi,
first of all thanx for your answer...
I've tried to do what you said, I've seen, using Iptraf, that something
works, but not properly..
Without using -i identity it doesn't work at all, adding that it trys to
connect but the connaction isn't established.
I've tried exactly the code you write in that mail but I receive any
result.
The thing I need to do is connecting to a remote machine andh copy some
files from it...
I've even tried scp but the problem is the same, it cannot establish the
connection.
....and I really don't know why...
Lorenza
On Mon, 27 Oct 2003, it was written:
[color=blue]
> 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" <soverini@cs.unibo.it> wrote in message
> news:Pine.LNX.4.21.0310271956000.31393-100000@pisolo.cs.unibo.it...[color=green]
> > 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
> >[/color]
>
>
>[/color]