骆驼sftp-对于无密码登录设置-我收到Jsch异常:验证失败

时间:2018-08-29 19:14:26

标签: apache-camel sftp jsch camel-ftp

我正在尝试连接到我具有无密码身份验证设置的SFTP服务器。我可以从终端连接到该服务器。但是,当我尝试使用Springboot-Camel-SFTP访问服务器时,出现异常:

2018-08-29 14:59:24,617警告org.apache.camel.component.file.remote.SftpConsumer:错误自动创建目录:传入由于无法连接到sftp://username@host.net:22。该异常将被忽略。 org.apache.camel.component.file.GenericFileOperationFailedException:无法连接到sftp://username@host.net:22

原因:com.jcraft.jsch.JSchException:验证失败     在com.jcraft.jsch.Session.connect(Session.java:519)     在org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:116)     ...省略了33个共同的框架

这是我路线的终点:     文件端点:sftp://username@host.net/incoming?streamDownload = true&noop = true&disconnect = true&stepwise = false&useList = false&fileName = abc.txt&ignoreFileNotFoundOrPermissionError = false&sendEmptyMessageWhenIdle = true&privateKeyPassphrase = XXX&preferredAuthentications = public_ / ler = id spring&scheduler.cron = 0 + 0/1 + + + +

任何帮助将不胜感激。谢谢!

2 个答案:

答案 0 :(得分:0)

简单答案:即使密码可能为空,也要添加用户名和密码。


长答案: 我有几个工作路线 username=something&password=&privateKeyPassphrase=XXX&preferredAuthentications=publickey&privateKeyFile=id_rsa

顺便说一句,私钥的路径让我感到焦虑,默认情况下,在linux上,允许本地用户使用本地文件作为私钥ssh密钥,只有密钥是“ chmod 400”或类似的东西。请检查您的Karaf或Servicemix实例是否可以正确读取此路径。

此外,您可以通过

查看整个sFTP锻炼
log4j.logger.org.apache.camel.component.file.remote.SftpOperations = ON

答案 1 :(得分:0)

根据文件名,我假设使用RSA密钥-确保是这种情况。我在使用ed25519键的JSch时遇到了问题。

此外,在我设置的SFPT路由中,我不在URI中使用“ user @”;我只有

 sftp://some.host/directory?username=someone?privateKeyFile=<>[..options..]

但是我没有像fliot所示的那样包含空白密码属性

最后,您可以尝试检查目标服务器的sshd日志。它可能有一些有用的东西。