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.
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
scpwithout public-key auth, you can do it either by using anexpectlibrary to enter the password intoscp, or by using ansshlibrary instead of invoking thescpcommand externally. Either way, you’ll have to set up a wrapper that gets used bycroninstead of callingscpdirectly.