NAME

Net::SFTP::Foreign::Backend::Net_SSH2 - Run Net::SFTP::Foreign on top of Net::SSH2

SYNOPSIS

  use Net::SFTP::Foreign;

  my $sftp = Net::SFTP::Foreign->new($host,
                                     backend => 'Net_SSH2',
                                     username => $user,
                                     password => $pass);
  $sftp->error and
    die "Unable to stablish SFTP connection: ". $sftp->error;


  # or...

  use Net::SSH2;

  my $ssh2 = Net::SSH2->new();
  $ssh2->connect($host)
    or die "connect failed";
  $ssh2->auth_password($user, $pass)
    or die "password auth failed";
  my $sftp = Net::SFTP::Foreign->new(ssh2 => $ssh2,
                                     backend => 'Net_SSH2');
  $sftp->error and
    die "Unable to stablish SFTP connection: ". $sftp->error;

  $sftp->get("foo", "foo") or die "get failed: " . $sftp->error;

DESCRIPTION

This module implements a Net::SFTP::Foreign backend that uses Net::SSH2 as the SSH transport layer.

To use it, include the argument backend => 'Net_SSH2' when calling Net::SFTP::Foreign constructor.

The constructor will them accept the following options:

ssh2 => $ssh2

A Net::SSH2 object already connected to the remote host and authenticated.

host => $host
hostname => $host
port => $port
user => $user
username => $username
rank => $rank
password => $password
publickey => $publickey_path
key_path => $privatekey_path
privatekey => $privatekey_path
passphrase => $passphrase
local_username => $local_username
interact => $interact
cb_keyboard => $cb_keyboard
cb_password => $cb_password

These options are passed to Net::SSH2 connect and auth methods in order to stablish an SSH authenticated connection with the remote host.

SUPPORT

This backend is completely experimental!

To report bugs, send me and email or use the CPAN bug tracking system at http://rt.cpan.org.

SEE ALSO

Net::SFTP::Foreign and Net::SSH2 documentation.

Net::SSH2 contains its own SFTP client, Net::SSH2::SFTP, but it is rather limited and its performance very poor.

COPYRIGHT

Copyright (c) 2009-2012, 2019-2020 by Salvador Fandiño (sfandino@yahoo.com).

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included as part of this package.