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
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");