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;
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
authmethods in order to stablish an SSH authenticated connection with the remote host.
This backend is completely experimental!
To report bugs, send me and email or use the CPAN bug tracking system at http://rt.cpan.org.
Copyright (c) 2009-2012, 2019 by Salvador Fandiño (firstname.lastname@example.org).
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.