SPUG: Net::SFTP Connection

Bradley Young byoung at speakeasy.org
Mon Mar 16 09:41:02 PDT 2009

Throw the openssh server in debug mode, and look at the logs.  My guess would be that the server is unwilling to establish a connection because it can't negotiate a cipher that it likes (or something similar).


Joshua ben Jore <twists at gmail.com> wrote:

>On Mon, Mar 16, 2009 at 5:36 AM, Phil Kirsch <kirsch.phil at gmail.com> wrote:
>> #!/usr/bin/perl
>> use strict;
>> use Net::SFTP;
>> my $user = "IPX0611B0811_ACI_DATA";
>> my $host = 'SFTP.impaxlabs.com';
>> my $pass = "impax";
>> my $logn = "$user" . "\@" . $host;
>> my $sftp = Net::SFTP->new("$logn", password=>"$pass", debug=>1);
>> print ("Done\.\n");
>> The results come out like this:
>> # ./transfer.pl
>> datafax3: Reading configuration data /root/.ssh/config
>> datafax3: Reading configuration data /etc/ssh_config
>> datafax3: Allocated local port 1023.
>> datafax3: Connecting to IPX0611B0811_ACI_DATA at SFTP.impaxlabs.com, port 22.
>> datafax3: Remote protocol version 2.0, remote software version OpenSSH_5.1
>> datafax3: Net::SSH::Perl Version 1.34, protocol version 2.0.
>> .atafax3: No compat match: OpenSSH_5.1
>> datafax3: Connection established.
>> datafax3: Sent key-exchange init (KEXINIT), wait response.
>> datafax3: Algorithms, c->s: 3des-cbc hmac-sha1 none
>> datafax3: Algorithms, s->c: 3des-cbc hmac-sha1 none
>> datafax3: Entering Diffie-Hellman Group 1 key exchange.
>> datafax3: Sent DH public key, waiting for reply.
>> 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?
>Yes, but with the caveat that this is just basic *NIX debugging and I
>nothing about the actual perl module.
>- Tried following the conversation with tcpdump?
>- Firewalls preventing in or outbound communication?
>- strace to see if somethink hinky shows up?
>- try telnetting to the ssh server to see if it shows you its header
>and it responds to the "garbage" you type back to it
>Seattle Perl Users Group Mailing List
>     POST TO: spug-list at pm.org
>SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>    MEETINGS: 3rd Tuesdays
>    WEB PAGE: http://seattleperl.org/

Sent from my Android phone with K-9. Please excuse my brevity.

More information about the spug-list mailing list