Re: Command Line Script
| From: | Chris Shiflett | Date: | Sat, 30 Oct 2004 06:43:55 +0000 |
| Subject: | Re: Command Line Script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200699@lists.php.net to get a copy of this message | ||
--- Steve Douville <php@douville.net> wrote:
> I'm trying to write something to run as a cron job that will
> perform an sftp command and then run a batch file. I was trying
> to use:
>
> system("sftp user@host")
>
> But that stalls and waits for a password before continuing with
> the script. Any ideas on how to pass the password when it's
> prompted?
Yes, you have to use a language like Expect.
If you want to stick with PHP, you're better off using an ssh key, so that
you're not prompted for the password.
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004 http://httphandbook.org/