I am new to Jsch and I am trying to connect to a third party via sftp. I can connect via ssh, so I know that I have the correct user, host, port and private key file, but when I try to connect via Jsch, I get an "Auth failed" error message that is almost, but not quite useful . Here is my code that I compiled from examples on the Internet:
String pvtkey = "{unixpath}/id_dsa";
ChannelSftp sftp = null;
JSch jsch = new JSch();
Session session = null;
try{
jsch.setKnownHosts("{unixpath}/known_hosts");
jsch.addIdentity(pvtkey);
session = jsch.getSession(user, connectionURL, 22);
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
...some other code that never gets called
}catch(JSchException e){
log.info(e.getMessage());
log.error(e.getCause());
}
, , session.connect(). URL , . pvtkey known_hosts - unix , , , script tht, . sftp, , Jsch-? ?