Re: SSH system command problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Thus wrote Linn Fagerberg:
> Hi,
> 
> I am trying to use a php system command to run a script and access files
> from another server using SSH. This does not seem to work in PHP or else I
> am doing it wrong because I keep on getting the system return value=255 when
> I do 
> 
>  
> 
> system("/usr/bin/ssh 10.0.0.1", $value)
> 
>  
> 
> I tried to do a "ssh -help" command to see if the reason it did not work was
> that there was a problem with the server, but that did not give me a correct
> return value either, so I am starting to suspect that ssh is different from
> other system commands in php?

If you just do something like:

  ssh hostname

Then ssh will try and establish a terminal connection. If you're
trying to do a command of some sort it will be:

  ssh hostname command


Then of course you'll need to somehow authenticate.. you can google
'man ssh' to find out how to use ssh if you don't have shell access
to the machine.

> 
> Is it possible to run ssh using php system command or do I have to try
> something else? I found a new php library called ssh2 but I don't know if
> that could be the solution to my problem? Have anyone used it?

Yes, there is a ssh2 library available for php, it is currently in
beta release, but from my experience it is quite stable to use.

PECL Extension:
http://pecl.php.net/ssh2

Documentation:
http://php.net/ssh2


HTH,

Curt
-- 
Quoth the Raven, "Nevermore."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux