tags:

views:

20

answers:

1

Hi folks,

I have a nightly database backup which I would like to scp to a remote server. As near as I can tell scp cannot be invoked with a password in the command and instead you need to set up keys for the servers?

Per this http://www.spaceprogram.com/knowledge/cron_scp.html

The remote box owner does not want me to set up the keys so what would you do to get the file from one box to the other via a cron job?

Thanks,

JG

+1  A: 

Why does the remote owner not want you to set up keys?

The key is the same as a password, or even better because it's easier to track where it's used. The right solution is, without a doubt, to generate a keypair and use that for unattended authentication.

Now, if you really need to use scp without public-key auth, you can do it either by using an expect library to enter the password into scp, or by using an ssh library instead of invoking the scp command externally. Either way, you'll have to set up a wrapper that gets used by cron instead of calling scp directly.

Borealid
I think it is a case of fear born of ignorance. The response I got was "You can store the files here. That is it. We are not adding or changing anything." but the owner of said files wants them stored on this particular server. I can just write a SFTP script in Perl.
jerrygarciuh
Someone over there talked them down off the ledge. Have got key based auth working from cron. Thanks!
jerrygarciuh