NYCPHP Meetup

NYPHP.org

[nycphp-talk] (no subject)

Joel De Gan joel at tagword.com
Thu Jul 15 12:45:59 EDT 2004


You may want to look at dsa keys, that is how I do it.
You create a dsa key and then add it to your known hosts file in
~home/.ssh/ 
Another alternative which works well is using php to call an expect
script, that way you don't need to bother with dsa keys (if security is
a concern).
'expect' comes with a script called autoexpect that you can quickly use
to create an expect script just 'autoexpect scp ..whatever..' and it
will create a script that you can call with 'expect script.exp' that
will do what you did during the autoexpect situation.
I have found that it is usually good to modify scripts done with
autoexpect though.

cheers

On Thu, 2004-07-15 at 16:42, wfan at encogent.com wrote:
> Hello Listies,
> 
> I am creating files with a PHP script. I want the script to 'scp' the
> just-created file to a Windows box running a SSH/SCP server (WinSSHD)
> 
> The created files are owned by 'www'
> 
> I want to scp the files so that there is no prompt for a password --  as I
> understand it, this is 'RSA Authentication'
> 
> I created a keypair using 'ssh-keygen -t dsa' and registered the public key
> with the WinSSHD server.
> 
> Then, in the PHP script:
> 
> #####PHP#######
> 	$command = 'scp -q -B -i <PRIVATE_KEY> ' . $filename . '
> <USER>@<IP_ADDY>:' . basename($filename);
> 	system( $command, $rc ); 
> #####PHP#######
> 
> where:
> 
> <PRIVATE_KEY> is the private key of the keypair
> $filename is the just-created file
> <USER> is a Windows account
> <IP_ADDY> is the IP of the Windows machine
> 
> 
> 
> Now, if I shell into the webserver and run the command, it works fine. BUT,
> the system() looks like it fails...
> 
> Any hints? Can you tell me where else to look? 
> 
> --
> Wellington
> 
> 
> 
> 
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
-- 
joeldg - developer, Intercosmos media group.
http://lucifer.intercosmos.net




More information about the talk mailing list