linux rsync用户名密码,bash – 脚本中rsync的用户名和密码

我正在创建一个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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值