Hi,
I am trying to use Net::SFTP on the linux to connect to a SFTP server on the Windows. I can establish the connection using command line as:
sftp user@windows_host
with password prompt.
However the following perl scripts can't establish the connection.
use strict;
use warnings;
use Net::SFTP;
my $file = 'xyz.txt';
my $host = 'xxx.xxx.xxx.xx';
my $user = 'user';
my $pass = 'pass';
my $destdir = '/dir';
my $sftp = Net::SFTP->new($host,$user,$pass)
|| die "Can not make connection to: $host\n";
$sftp->put($file,$destdir) || die "can't put files: $!\n";
The error msg is: Permission denied at /usr/local/lib/perl5/site_perl/5.12.2/Net/SFTP.pm line 62.
But the same username and password worked fine on the command line.
Any help will be greatly appreciated. Thanks much.
|