我正在创建一个cron作业,以保持两个目录同步.我正在使用rsync.我正在运行一个rsync守护进程.我阅读了手册并说:
RSYNC_PASSWORD Setting RSYNC_PASSWORD to the required password allows you to run authenticated rsync connections to an rsync daemon without user intervention. Note that this does not supply a password to a shell transport such as ssh. USER or LOGNAME The USER or LOGNAME environment variables are used to determine the default username sent to an rsync daemon. If neither is set,the username defaults to 'nobody'
我有类似的东西:
#!/bin/bash USER=name RSYNC_PASSWORD=pass DEST="myhost::mymodule" /usr/bin/rsync -rltvvv . $DEST
我也试过导出(危险,我知道)USER和RSYNC_PASSWORD.我也尝试过使用LOGNAME.什么都行不通.我这样做了吗?
编辑(澄清)
我在linux下使用rsync版本2.6.9.
此命令有效:
/usr/bin/rsync -rltvvv . myuser@myhost::mymodule
我被提示输入密码,当我输入密码时,传输开始.
这是我通过脚本尝试时遇到的错误:
opening tcp connection to myhost port 873 opening connection using --server -vvvltr . mymodule @ERROR: auth Failed on module mymodule rsync error: error starting client-server protocol (code 5) at main.c(1383) [sender=2.6.9] _exit_cleanup(code=5,file=main.c,line=1383): about to call exit(5)
你尝试过类似的东西:
原文链接:https://www.f2er.com/bash/385749.htmlrsync -rltvvv --password-file=/root/secret . user@host::dest