Establishing a connection

Top  Previous  Next

To establish a connection create a com.jscape.inet.ssh.util.SshParameters instance providing hostname, username and password arguments. Using this constructor you will authenticate with the server using username/password authentication. In addition to username/password authentication the Sftp class also supports public key authentication. Using the newly created SshParameters instance as an argument to the constructor, construct a new com.jscape.inet.sftp.Sftp instance and invoke the Sftp#connect method.

 

Example

 

import com.jscape.inet.ssh.util.*;

import com.jscape.inet.sftp.*;

 

// create a new SshParameters instance with authentication info

SshParameters sshParams(hostanme,username,password);

 

// create a new Sftp instance    

Sftp sftp = new Sftp(sshParams);

 

// establish a connection

sftp.connect();

 

 

See also Public key authentication





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC