Package net.schmizz.sshj

Examples of net.schmizz.sshj.SSHClient.authPassword()


  private void exec(String command) throws IOException {
    SSHClient ssh = new SSHClient();
    ssh.loadKnownHosts();
    ssh.addHostKeyVerifier(new NullHostKeyVerifier());
    ssh.connect(vmName);
    ssh.authPassword(vmUser, vmPwd);

    final Session session = ssh.startSession();
    try {
      final Command cmd = session.exec(command);
      System.out.println(IOUtils.readFully(cmd.getInputStream()).toString());
View Full Code Here


                        logger.info("connecting to {}", sshAddress.address);

                        SSHClient ssh = new SSHClient();
                        ssh.loadKnownHosts(new File(SystemUtils.getUserHome(), ".ssh/known_hosts"));
                        ssh.connect(sshAddress.address);
                        ssh.authPassword(sshAddress.username, sshAddress.password);

                        return ssh;
                    } catch (Exception e) {
                        final String fingerprint = StringUtils.substringBetween(
                            e.toString(), "fingerprint `", "`");
View Full Code Here

                        SSHClient ssh = new SSHClient();

                        ssh.loadKnownHosts(new File(SystemUtils.getUserHome(), ".ssh/known_hosts"));
                        ssh.addHostKeyVerifier(fingerprint);
                        ssh.connect(sshAddress.address);
                        ssh.authPassword(sshAddress.username, sshAddress.password);

                        return ssh;
                    }
                }
            }));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.