开发者

Can scp be used non-interactively in cron without generating keys?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜