开发者

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

开发者 https://www.devze.com 2023-01-11 17:25 出处:网络
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 ser

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

精彩评论

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