I am trying to use Net::SCP on the linux to copy files from a linux machine to a Windows machine. I can do so using command line as:
scp local_file user@windows_host:/dir
with password prompt. However the following perl script net_scp.pl doesn't work.
use strict; use warnings; use Net::SCP; my $file = 'xyz.txt'; my $destdir = '/dir'; my $host = 'xxx.xxx.xxx.xx'; my $user = 'user'; my $pass = 'pass'; my $scpe = Net::SCP::Expect->new(host => $host, user => $user, password => $pass) || die "Can not make connection to: $host\n"; $scpe->scp($file,$destdir) || die "can't scp: $!\n";
The error msg is: Problem performing scp: lost connection at ./net_scp.pl line 28. The line 28 is the last line above. But the same username and password worked fine on the command line. Any help will be greatly appreciated. Thanks much.

-----Inline Attachment Follows----- ------------------------------------------------------------------------------ RSA® Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 -----Inline Attachment Follows----- _______________________________________________ Ssh-sftp-perl-users mailing list Ssh-sftp-perl-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users Go to Previous message | Go to Next message | Back to Messages | Full Headers Reply Reply All Forward Forward Mail Search WelcomeInboxNewFoldersMail Options


In reply to Net::SCP can't connect to Windows server by perlfun

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.