0

QuickSSH首页、文档和下载 - 纯 Java SSH 客户端 - OSCHINA - 中文开源技术交流社区

 2 years ago
source link: https://www.oschina.net/p/quickssh
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

QuickSSH首页、文档和下载 - 纯 Java SSH 客户端 - OSCHINA - 中文开源技术交流社区

QuickSSH:纯Java实现SSH协议

  • 导入QuickSSH
<dependency>
  <groupId>cn.schoolwow</groupId>
  <artifactId>QuickSSH</artifactId>
  <version>{最新版本}</version>
</dependency>

QuickSSH最新版本查询

  • 构建SSHClient
//密码方式登录
SSHClient client = QuickSSH.newInstance()
        .host("127.0.0.1")
        .port(22)
        .username("root")
        .password("123456")
        .build();
//公钥文件方式登录
SSHClient client = QuickSSH.newInstance()
        .host("127.0.0.1")
        .port(22)
        .username("root")
        //目前仅支持rsa类型
        .publickey("/path/to/id_rsa", "passphrase")
        .build();
//执行exec命令
String resut = sshClient.exec("pwd");
//获取sftp命令
SFTPChannel sftpChannel = sshClient.sftp();
sftpChannel.xxxxxx();

若有问题请提交 Issue或者发送邮件到 [email protected]

本软件使用LGPL开源协议!

展开阅读全文

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK