If I understand correctly, the SSH server is running on Windows and the transfer script (which is running on Linux) obtains the file from the Windows machine using scp_get().
This could mean that the problem is with the SSH server on the Windows machine, and nothing to do with perl at all.
A small example script that demonstrates the problem might help.
I couldn't find any such problem when using a Net::SSH2 script (run on my Windows machine) to scp_put() the file onto my Linux machine. I ran this:
## scp.pl ##
use strict;
use warnings;
use Net::SSH2;
die "Usage: perl scp.pl username password"
unless @ARGV == 2;
my $host = '192.168.0.101';
my $user = $ARGV[0];
my $password = $ARGV[1];
my $ssh2 = Net::SSH2->new();
$ssh2->debug(1);
print "\nconnecting to $host...\n";
$ssh2->connect($host) or die $ssh2->error;
print "\nauth to $host...\n";
$ssh2->auth_password($user,$password) or die $ssh2->error;
printf "Auth OK: %s\n", $ssh2->auth_ok;
print "scp put\n";
my $ret = $ssh2->scp_put("rub'bish.txt",
"/home/sisyphus/Downloads/rub'bish.txt");
print "ret: $ret\n";
$ssh2->disconnect();
It transferred
rub'bish.txt from the windows machine to the Linux machine just fine.
Unfortunately my Windows machine doesn't have an SSH server so I can't try doing it the "other" way.
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.