Re: SSH system command problem

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

 



On Monday 31 January 2005 16:44, Linn Fagerberg wrote:

> 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, 

  system("/usr/bin/ssh --help", $value);

should certainly work, but $value is 1.


> so I am starting to suspect that ssh is 
> different from other system commands in php?

I don't think PHP makes any distinction between whatever system commands you 
use.

> Is it possible to run ssh using php system command or do I have to try
> something else?

OK, when you run ssh on the command line, the first time you connect to any 
host you'll get asked to verify the remote host's fingerprint, this then gets 
added to ~/.ssh/known_hosts. So the first thing you should do perform this 
step.

Then the next thing is you usually need a password to access the remote host, 
as it's usually pretty difficult to enter a password if you want to run this 
script non-interactively so you make use of keys:

  google > using ssh without password

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

-- 
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