已经解决了,在man中有这样的说明:
--password-file
This option allows you to provide a password in a file for accessing a remote rsync server. Note that this option is only useful when accessing a rsync server using the built in transport, not when using a remote shell as the transport. The file must not be world readable. It should contain just the password as a single line.
所以上面的命令应该改成:
/usr/bin/rsync -vazu --progress --password-file=/etc/rsync_secret --delete user@192.168.0.100::my /home/user1/
这里要使用“::”,面不是“:”,否则是启用了remote shell 来传输,--password-file参数无效了。
至于/etc/rsync_secret里,我只用了写了user用户的密码
cat /etc/rsync_secret
password |