title: Net::SFTP::Foreign password authentication error
body: <p>I'm running the following script to connect to a sftp:</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  use POSIX;
  use File::Path qw(make_path);
  use File::Copy;
  use IO::Handle;
  use IO::File;
  use Data::Printer;
  use Net::SFTP::Foreign;
  $Net::SFTP::Foreign::debug = -1;
  
  STDOUT-&gt;autoflush(1);
  STDERR-&gt;autoflush(1);
  
  my ($genCfgFile) = &lt;@ARGV&gt;;
  
  if (!defined($genCfgFile)||($genCfgFile eq '')){
      print "Usage: $0 cfgFile";
      exit(1);
  }
  
  my %User_Preferences=readCfgFile($genCfgFile);
      print p(%User_Preferences)."\n";
  getFilesFromSFTP(\%User_Preferences);
  
  exit(0);
  
  sub getFilesFromSFTP{
      my ($User_PreferencesHref)=@_;
      my $FtpHost=$User_PreferencesHref-&gt;{"FTP_HOST"} or die "Missing parameter FTP_HOST in cfg file.\n";
      my $FtpPort=$User_PreferencesHref-&gt;{"FTP_PORT"} or die "Missing parameter FTP_PORT in cfg file.\n";
      my $FtpUser=$User_PreferencesHref-&gt;{"FTP_USER"} or die "Missing parameter FTP_USER in cfg file.\n";
      my $FtpPwd=$User_PreferencesHref-&gt;{"FTP_PWD"} or die "Missing parameter FTP_PWD in cfg file.\n";
  
      my %args = (user =&gt; $FtpUser, password =&gt; $FtpPwd, port =&gt; $FtpPort);
  
      print p(%args)."\n";
  
      my $sftp= Net::SFTP::Foreign-&gt;new($FtpHost, %args) or die "Cannot connect to : $@";
      my $entries = $sftp-&gt;ls;
      print p(@$entries)."\n";
  }
  </code></pre>
  
  <p>However, it somewhat fails during the password autenthication, this is the debug log:</p>
  
  <pre><code>#12200 1438942500.00000 new: This is Net::SFTP::Foreign 1.77
  #12200 1438942500.00000 new: Loaded from /usr/lib/perl5/site_perl/5.8.5/Net/SFTP/Foreign.pm
  #12200 1438942500.00000 new: Running on Perl for linux
  #12200 1438942500.00000 new: debug set to -1
  #12200 1438942500.00000 new: ~0 is 18446744073709551615
  #12200 1438942500.00000 new: Using backend Net::SFTP::Foreign::Backend::Unix 1.76_03
  #12200 1438942500.00000 _init_transport: ssh cmd: ssh -p 22 -o NumberOfPasswordPrompts=1 -o PreferredAuthentications=keyboard-interactive,password -l bnp 10.255.235.10 -s sftp
  
  #12200 1438942500.00000 _init_transport: starting password authentication
  #12200 1438942500.00000 _init_transport: waiting for data from the pty to become available
  #12200 1438942500.00000 _init_transport: 30 bytes readed from pty:
  62 6e 70 40 31 30 2e 32 35 35 2e 32 33 35 2e 31 30 27 73 20 70 61 73 73 77 6f 72 64 3a 20 | bnp@10.255.235.10's password:
  #12200 1438942500.00000 _init_transport: looking for user/password prompt
  #12200 1438942500.00000 _init_transport: matching against (?i-xsm:(user|name|login)?[:?]\s*$)
  #12200 1438942500.00000 _init_transport: sending password
  #12200 1438942500.00000 _init_transport: waiting for data from the pty to become available
  #12200 1438942500.00000 _init_transport: 2 bytes readed from pty:
  0d 0a | ..
  #12200 1438942500.00000 _init_transport: looking for password ok
  #12200 1438942500.00000 _init_transport: password authentication done
  #12200 1438942500.00000 _queue_msg: queueing msg len: 5, code:1, id:3 ... [1]
  00 00 00 05 01 00 00 00 03 | .........
  #12200 1438942500.00000 _get_msg: waiting for message... [1]
  #12200 1438942500.00000 _do_io: _do_io connected: 1
  #12200 1438942500.00000 _do_io: _do_io select(-,-,-, undef)
  #12200 1438942500.00000 _do_io: _do_io write queue: 9, syswrite: 9, max: 65536, $!:
  00 00 00 05 01 00 00 00 03 | .........
  #12200 1438942500.00000 _do_io: _do_io select(-,-,-, undef)
  Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
  #12200 1438942502.00000 _do_io: _do_io read sysread: 0, total read: 0, $!:
  #12200 1438942502.00000 _conn_lost: _conn_lost
  #12200 1438942502.00000 _set_status: _set_status code: 7, str: Connection lost
  #12200 1438942502.00000 _set_error: _set_err code: 37, str: Connection to remote server is broken
  #12200 1438942502.00000 _conn_lost: _conn_lost
  #12200 1438942502.00000 disconnect: Net::SFTP::Foreign=HASH(0xee3d50)-&gt;disconnect called (ssh pid: 12201)
  #12200 1438942502.00000 _conn_lost: _conn_lost
  #12200 1438942502.00000 disconnect: starting dirty cleanup of process 12201
  #12200 1438942502.00000 disconnect: killing process 12201 with signal 0
  #12200 1438942502.00000 disconnect: waitpid returned 12201
  #12200 1438942502.00000 disconnect: process 12201 reaped
  #12200 1438942502.00000 DESTROY: Net::SFTP::Foreign=HASH(0xee3d50)-&gt;DESTROY called (current pid: 12200, disconnect_by_pid: )
  #12200 1438942502.00000 disconnect: Net::SFTP::Foreign=HASH(0xee3d50)-&gt;disconnect called (ssh pid: )
  #12200 1438942502.00000 _conn_lost: _conn_lost
  </code></pre>
  
  <p>I'm using IO::Pty v 1.12 and Net::SFTP::Foreign 1.77, can anybody help me?</p>