SFTP connection through Java asking for weird authentication

前端 未结 3 402
执念已碎
执念已碎 2020-12-13 00:04

So I\'m writing a little program that needs to connect to a remote server through SFTP, pull down a file, and then processes the file. I came across JSch through some answer

3条回答
  •  囚心锁ツ
    2020-12-13 00:31

    While the solution in the self-accepted answer is correct, it lacks any explanation.

    The problem is that the OP have a Kerberos/GSSAPI authentication set as the preferred (the JSch default). Yet OP does not seem to actually use/want it, as OP claims not to specify any username or password for the Kerberos prompts.

    The solution is to remove the Kerberos/GSSAPI (gssapi-with-mic) from the list of preferred authentication methods:

    session.setConfig(
        "PreferredAuthentications", 
        "publickey,keyboard-interactive,password");
    

提交回复
热议问题