session.setPassword("password");
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
channelSftp = (ChannelSftp) session.openChannel("sftp");
channelSftp.connect();
} catch (JSchException | SftpException | IOException e) {
logger.error(e.getMessage(), e);
} finally {
if (channelSftp != null) {
channelSftp.disconnect();
}
if (session != null)
session.disconnect();
}
}








