我正在设置自动同步本地和远程文件夹的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.发布于 2017-01-13 22:10:36
如果你使用的是ubuntu12.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/
https://stackoverflow.com/questions/27342407
复制相似问题