0

I have problem of connection with JSch , there is the code that i'm using for establishing the session, i already set the login and password, but after executing it , the input console still prompt for typing the login and password , and whatever what i type, it create the connection successfully .

How can i fix that please, i want that the program don't require any human interaction so i can execute it automatically?

//There is a screenshot of the ouput : http://www.hostingpics.net/viewer.php?id=932299jschproblem.png

public class jschConnect{

public static void main(String args[])
{   
 String host="x.x.x.x";
 String user="username";
 String password="
 try{

java.util.Properties config = new java.util.Properties(); 
config.put("StrictHostKeyChecking", "no");
JSch jsch = new JSch();

Session session=jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig(config);

session.connect();
System.out.println("Connected");

}}}
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

-1

Problem fixed, here is a similar issue.

I just added this code ,to remove the Kerberos/GSSAPI (gssapi-with-mic) from the list of preferred authentication methods:

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