Lsyncd权限被拒绝(公钥,密码)

时间:2014-12-07 12:02:51

标签: ssh rsync

我正在为自动同步本地和远程文件夹设置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.

1 个答案:

答案 0 :(得分:0)

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

试试这个:

PowerShell[.exe] [-PSConsoleFile <file> | -Version <version>]
    [-NoLogo] [-NoExit] [-Sta] [-Mta] [-NoProfile] [-NonInteractive]
    [-InputFormat {Text | XML}] [-OutputFormat {Text | XML}]
    [-WindowStyle <style>] [-EncodedCommand <Base64EncodedCommand>]
    [-ConfigurationName <string>]
    [-File <filePath> <args>] [-ExecutionPolicy <ExecutionPolicy>]
    [-Command { - | <script-block> [-args <arg-array>]
                  | <string> [<CommandParameters>] } ] 

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