How to skip Kerberos Authentication : JSch JAVA

While connecting with a jump server i wrote following code.

try
{
session = jsch.getSession(JumpServerUserName, JumpServerIP, 22);
session.setConfig("StrictHostKeyChecking", "no");
session.setPortForwardingL(localPort, JumpServerIP, 22);
session.setUserInfo(new MyUserInfo());
session.setPassword(e1);
session.connect();
}
catch(Exception tre)
{
System.out.println("The session could not be established to " + JumpServerUserName + "@" + JumpServerIP+new Timestamp(System.currentTimeMillis()));
}

The code worked fine but i was getting following messages.

Kerberos username [Username]:

Kerberos password for [Username]:

The messages didnt interfere with the functionality of the code but required user to click enter twice on the screen which was cumbersome.

Adding the below line was my solution.

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

Happy Coding.

🙂

4 thoughts on “How to skip Kerberos Authentication : JSch JAVA

  1. Hi there it’s me, I am also visiting this website on a regular
    basis, this web page is truly nice and the people are actually sharing pleasant thoughts.

Leave a Reply to bitly.com Cancel reply

Your email address will not be published.

Verified by MonsterInsights