SPUG: Net::SFTP Connection

Paul Goracke paul at goracke.org
Mon Mar 16 09:49:08 PDT 2009


On Mar 16, 2009, at 5:36 AM, Phil Kirsch wrote:

> my $logn = "$user" . "\@" . $host;
> my $sftp = Net::SFTP->new("$logn", password=>"$pass", debug=>1);
>
I haven't used Net::SFTP before, but is "user at host" a valid first  
param? The POD looks like the first param should simply be $host, and  
$user should be passed in the trailing hash with the key 'user'.
> 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?

I usually encounter these ssh-related "long pause, then disconnect"  
when the auth is invalid, or in bizarre cases when the remote host  
can't do reverse DNS against the script host.

First, try removing the script and module from the equation: Can you  
make the connection manually from the script host to remote host?

Second, umm...not sure, many paths.

pg



More information about the spug-list mailing list