在某些情况下,sshpass 尝试将“assword”作为默认密码提示指示器。但是 rsync 可以返回类似的字符串:
Enter passphrase for key '/home/user/.ssh/private_user_key':
因此,尝试添加“-P”参数:
sshpass -p "yourpassword" -P 'Enter passphrase for key' rsync 111.111.111.111:/backup/origin /backup/destination/
您可以在 /home/user/config 中设置或使用 -e 参数设置私钥的路径,如下所示:
sshpass -p "yourpassword" -P 'Enter passphrase for key' rsync -e 'ssh -i /home/user/.ssh/private_user_key' 111.111.111.111:/backup/origin /backup/destination/
有关默认密码提示指示器的更多信息:
$ sshpass -V
sshpass 1.06
(C) 2006-2011 Lingnu Open Source Consulting Ltd.
(C) 2015-2016 Shachar Shemesh
This program is free software, and can be distributed under the terms of the GPL
See the COPYING file for more information.
Using "assword" as the default password prompt indicator.