[CDBUG-talk] SFTP in Perl script

Jaime jaime at snowmoon.com
Sat Jan 25 09:20:51 EST 2014

I have a script I've been using successfully at work for more than a
year.  At one point, it makes some ASCII files and uploads them to
another server via SFTP.  Recently, it started failing on the SFTP

I added the debugging flag to the SFTP connection and it gives output like this:

<local hostname>: Reading configuration data /home/edoctrina/.ssh/config
<local hostname>: Reading configuration data /etc/ssh_config
<local hostname>: Connecting to ftp.edoctrina.org, port #####.
<local hostname>: Remote protocol version 2.0, remote software version
<local hostname>: Net::SSH::Perl Version 1.34, protocol version 2.0.
<local hostname>: No compat match: mod_sftp/0.9.8
<local hostname>: Connection established.
<local hostname>: Sent key-exchange init (KEXINIT), wait response.
Connection closed by remote host. at
/usr/local/lib/perl5/site_perl/5.12.4/Net/SSH/Perl/Kex.pm line 146

For various reasons, I had to swap out the server's hostname and the
port number.  Sorry for the obfuscation.  "/home/edoctrina" is the
$HOME for the user executing the task.

The delay between the "Sent key-exchange..." and "Connection
closed..." lines is exactly 5 minutes.

When I use "sftp -P <port> <username>@<hostname>", I can authenticate
and use "ls -l" successfully.

Anyone have suggestions on debugging or fixing this script?

Thanks in advance,

More information about the CDBUG-talk mailing list