The
topic How
to use SFTP (introduction) describes
the SFTP features of SSHFTPClient. This topic demonstrates the use of
SFTP without server
validation.
Server validation should always be used in a production environment,
but disabling it is a good
way of getting started.
Using SFTP without server
validation is simply a matter of getting a reference to the current
validator and switching off host validation:
For password authentication, the
username and password of the SSH user must be passed into the setAuthentication
method,
and setRemoteHost
must be set to the server's hostname or IP address.
Note that
some SFTP servers are set up to disallow password authentication, in
which case the
connection attempt will fail unless password authentication is enabled
in the server
configuration file.
After
this a secure connection is established by calling connect():