Linux环境下nginx搭建简易图片服务器

2019-10-17 20:35:22刘景俊

        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();
    }
}