SPUG: Net::SFTP Connection

breno breno at rio.pm.org
Mon Mar 16 09:24:46 PDT 2009

On Mon, Mar 16, 2009 at 9:36 AM, Phil Kirsch <kirsch.phil at gmail.com> wrote:
> At this point there is a long pause, followed 15 or 20 seconds later by:
> Connection closed by remote host. at
> /usr/perl5/site_perl/5.8.4/Net/SSH/Perl/Kex/DH1.pm line 41
> Because the word "Done" does not print, I am quite certain that the script
> is simply dying at this point. Does anyone have any ideas for
> troubleshooting this problem?

Usually, messages in the format "$string at $file line $N" are fatal
errors indications suggesting what went wrong ($string), at which file
($file) in the line ($N). As the only line in your code doing
something other than passing strings to variables is your call to
Net::SFTP->new(), it's a safe bet something went wrong over there.

Since the dying message clearly states "Connection closed by remote
host", that's most likely what happened (interrupting the
diffie-hellman key exchange and causing a fatal error as you cannot
use an SFTP connection when there is none), so you should probably try
to connect to another (maybe local) server, to eliminate some
variables to your problem. Joshua's tips will most likely be very
useful in further troubleshooting the problem (which appears to be on
the infrastructure rather then on Net::SFTP itself).

If you feel you should be debugging the module, you could browse the
source code via CPAN's website or your local copy, but a good place to
start is to view a simple trace of your problem by doing something

# perl -MCarp::Always transfer.pl

instead of just "./transfer.pl". Of course, you'll need to have
Carp::Always installed on your system.



More information about the spug-list mailing list