Net::SFTP::Foreign::Backend::Net_SSH2 - Run Net::SFTP::Foreign on top of Net::SSH2
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;
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.
backend => 'Net_SSH2'
The constructor will them accept the following options:
A Net::SSH2 object already connected to the remote host and authenticated.
These options are passed to Net::SSH2 connect and auth methods in order to stablish an SSH authenticated connection with the remote host.
connect
auth
This backend is completely experimental!
To report bugs, send me and email or use the CPAN bug tracking system at http://rt.cpan.org.
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 (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.
To install Net::SFTP::Foreign::Backend::Net_SSH2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SFTP::Foreign::Backend::Net_SSH2
CPAN shell
perl -MCPAN -e shell install Net::SFTP::Foreign::Backend::Net_SSH2
For more information on module installation, please visit the detailed CPAN module installation guide.