从cygwin终端运行包含sshpass和rsync的命令非常有效。
从DOS批处理文件中运行相同的命令,似乎无法按预期工作。
我尝试了很多其他选项,包括不同的密码,变量密码和文本文件。
c:\cygwin64\bin\bash --login -c "sshpass -v -p 'Passhas$@!chars' rsync -av --no-p /cygdrive/c/fakeshare root@XXX.XXX.XXX.XXX:/mnt/pool/backup/_server/sync"
预期结果:
sending incremental file list sent 209 bytes received 17 bytes 90.40 bytes/sec total size is 27,564 speedup is 121.96
实际结果:
SSHPASS searching for password prompt using match "assword" root@XXX.XXX.XXX.XXX's password: SSHPASS detected prompt. Sending password. SSHPASS read:
然后什么都没有。