gpt4 book ai didi

ssh - Lsyncd 权限被拒绝(公钥、密码)

转载 作者:行者123 更新时间:2023-12-04 06:46:53 27 4
gpt4 key购买 nike

我正在为自动同步本地和远程文件夹设置 lsyncd。我研究了许多可用的解决方案,还向 conf 文件添加了额外的参数。
我也用 PermitRootLogin without-password 更新了 sshd_config

此外,我可以使用密码 ssh 和 rsync 手动尝试不使用密码,但问题是当我通过 lsyncd 使用它时,它给出了 3 次权限被拒绝错误并退出(似乎它要求输入密码)。

lsyncd.conf.lua 文件

settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status",
statusInterval = 10
}
sync {
default.rsync,
source="/home/gaurav/Desktop/source/",
target="root@xxx.xxx.xx.xxx:/root/destination/",
rsync = {
compress = true,
acls = true,
verbose = true,
_extra = {"-P", "-e", "/usr/bin/ssh -p 22 -i /home/gaurav/.ssh/id_rsa -o StrictHostKeyChecking=no"}
}
}

也尝试过这个。
settings = {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status"
}

sync {
default.rsyncssh,
source = "/home/gaurav/Desktop/source/",
host = "xxx.xxx.xx.xxx",
targetdir = "/root/destination/"
}

日志
Sun Dec  7 17:18:09 2014 Normal: recursive startup rsync: /home/gaurav/Desktop/source/ -> root@xxx.xxx.xx.xxx:/root/destination/
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.1]
Sun Dec 7 17:18:12 2014 Error: Temporary or permanent failure on startup of "/home/gaurav/Desktop/source/". Terminating since "insist" is not set.

最佳答案

如果您使用的是 ubuntu 12.04,则必须使用 rsyncOps 而不是 rsync = {} 块。

尝试这个:

sync { 
default.rsync,
source="/var/www/",
target=server..":/var/www/",
excludeFrom="/etc/lsyncd/lsyncd-excludes.txt",
rsyncOps={"-e", "/usr/bin/ssh -o StrictHostKeyChecking=no", "-avz"}
}

https://www.stephenrlang.com/2015/12/how-to-install-and-configure-lsyncd/

关于ssh - Lsyncd 权限被拒绝(公钥、密码),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27342407/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com