How to pass password automatically for rsync SSH command?

后端 未结 13 1660
情歌与酒
情歌与酒 2020-12-02 05:39

I need to do rsync by ssh and want to do it automatically without the need of passing password for ssh manually.

13条回答
  •  天涯浪人
    2020-12-02 06:18

    Another interesting possibility:

    1. generate RSA, or DSA key pair (as it was described)
    2. put public key to host (as it was already described)
    3. run:
    rsync --partial --progress --rsh="ssh -i dsa_private_file" host_name@host:/home/me/d .
    

    Note: -i dsa_private_file which is your RSA/DSA private key

    Basically, this approach is very similar to the one described by @Mad Scientist, however you do not have to copy your private key to ~/.ssh. In other words, it is useful for ad-hoc tasks (one time passwordless access)

提交回复
热议问题