How to pass password automatically for rsync SSH command?

后端 未结 13 1650
情歌与酒
情歌与酒 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:14

    The following works for me:

    SSHPASS='myPassword'
    /usr/bin/rsync -a -r -p -o -g --progress --modify-window=1 --exclude /folderOne -s -u --rsh="/usr/bin/sshpass -p $SSHPASS ssh -o StrictHostKeyChecking=no -l root"  source-path  myDomain:dest-path  >&2
    

    I had to install sshpass

提交回复
热议问题