Methods Summary |
---|
public boolean | getFailonerror()Get the failonerror flag.
return failOnError;
|
public java.lang.String | getHost()Get the host.
return host;
|
public int | getPort()Get the port attribute.
return port;
|
protected SSHUserInfo | getUserInfo()Get the user information.
return userInfo;
|
public boolean | getVerbose()Get the verbose flag.
return verbose;
|
public void | init()Initialize the task.
This initializizs the known hosts and sets the default port.
super.init();
this.knownHosts = System.getProperty("user.home") + "/.ssh/known_hosts";
this.port = SSH_PORT;
|
protected com.jcraft.jsch.Session | openSession()Open an ssh seession.
JSch jsch = new JSch();
if (null != userInfo.getKeyfile()) {
jsch.addIdentity(userInfo.getKeyfile());
}
if (!userInfo.getTrust() && knownHosts != null) {
log("Using known hosts: " + knownHosts, Project.MSG_DEBUG);
jsch.setKnownHosts(knownHosts);
}
Session session = jsch.getSession(userInfo.getName(), host, port);
session.setUserInfo(userInfo);
log("Connecting to " + host + ":" + port);
session.connect();
return session;
|
public void | setFailonerror(boolean failure)Set the failonerror flag.
Default is true
failOnError = failure;
|
public void | setHost(java.lang.String host)Remote host, either DNS name or IP.
this.host = host;
|
public void | setKeyfile(java.lang.String keyfile)Sets the keyfile for the user.
userInfo.setKeyfile(keyfile);
|
public void | setKnownhosts(java.lang.String knownHosts)Sets the path to the file that has the identities of
all known hosts. This is used by SSH protocol to validate
the identity of the host. The default is
${user.home}/.ssh/known_hosts.
this.knownHosts = knownHosts;
|
public void | setPassphrase(java.lang.String passphrase)Sets the passphrase for the users key.
userInfo.setPassphrase(passphrase);
|
public void | setPassword(java.lang.String password)Sets the password for the user.
userInfo.setPassword(password);
|
public void | setPort(int port)Changes the port used to connect to the remote host.
this.port = port;
|
public void | setTrust(boolean yesOrNo)Setting this to true trusts hosts whose identity is unknown.
userInfo.setTrust(yesOrNo);
|
public void | setUsername(java.lang.String username)Username known to remote host.
userInfo.setName(username);
|
public void | setVerbose(boolean verbose)Set the verbose flag.
this.verbose = verbose;
|