#!/usr/bin/perl use strict; use warnings; use Net::SSH2; use Net::SFTP::Foreign; use Net::SFTP::Foreign::Backend::Net_SSH2; my $host = 'localhost'; my $user = 'user'; my $pass = 'pass'; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect($host) or die "Connect failed!\n"; $ssh2->auth_password($user, $pass) or die "password auth failed\n"; my $sftp = Net::SFTP::Foreign->new(ssh2 => $ssh2, backend => 'Net_SSH2'); $sftp->error and die "Unable to establish a SFTP connection: ", $sftp->error; $sftp->put('/null.txt', '/root/Desktop/null.txt');
In reply to Re: question about objects / Net::SFTP
by Khen1950fx
in thread question about objects / Net::SFTP
by kurt2439
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |