I implemented a Java program that will connect and execute a command in a remote server using JSCH. The problem is that whenever I tried to connect to the server, I got the
Add this line of code after you have the Session instance:
public static Session createSession(Server srv){
JSch js = new JSch();
try {
Session s = js.getSession(srv.getUser().getUsername(), srv.getAddress(), 22);
s.setPassword(srv.getUser().getPassword());
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
config.put("PreferredAuthentications", "password");
config.put("kex", "diffie-hellman-group1-sha1");
s.setConfig(config);
...
The line to be added is: config.put("kex", "diffie-hellman-group1-sha1");