I have this script where I'm trying to scp a file from one box to my home box.

I think I set up the whole thing with ssh-keygen correctly. At least from a command prompt, I and do ssh remotebox and I'm logged in without ever being prompted for a password (this only works on my home box not when I'm on another box).

So my script is really simple.

use Net::SCP; my $scp = Net::SCP->new("10.33.1.75", "xorl") or die("COULD NOT SCP"); $scp->scp("/export/home/xorl/websterproject/xferlist.txt", "/tmp/webst +erproject_xfer.txt") or die("TRANSFER FAILED");

Now it always dies with "TRANSFER FAILED" /tmp/websterproject_xfer.txt is sometimes created as an empty file.

I believe the permissions are correct on xferlist.txt I can from a command prompt do scp 10.33.1.75:/export/home/xorl/websterproject/xferlist.txt /tmp/websterproject_xfer.txtand everything works fine (it never asks me for a password).

So now I'm trying to figure how do I see what exaclty is going on inside of Net::SSH. I tried running the script with -d but I was quickly over my head. It looked like to me everything was going fine and then all of a sudden kaboom it dies.

So can anyone help me figure out what the problem is and how to fix it? Do I need to spend much time with the debugger?

Thanks.


In reply to How do I debug a problem with Net:SSH by xorl

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.