madorb has asked for the wisdom of the Perl Monks concerning the following question:

So I have a perl script attempting to connect to an SFTP server using Net::SFTP::Foreign. I'm running Cygwin on windows XP using OpenSSH_5.1p1, OpenSSL 0.9.8k and Net::SFTP::Foreign 1.5.1. I've also installed IO::Pty and Expect.

print "Connecting: $staging_address - $ftp_username - $ftp_password\n" +); my $sftp = Net::SFTP::Foreign->new($staging_address, user=> $ftp_usern +ame, password => $ftp_password); print "Connected!";

The connection prints with the correct info, but then the program hangs forever. I've turned on debugging as well (via $Net::SFTP::Foreign = -1;) but get no output.
does anyone have any suggestions as to what i am doing incorrectly?

I've validated that the login name & password are correct and that the SFTP server is accepting connections. Does anyone have any suggestions?

Replies are listed 'Best First'.
Re: Net::SFTP::Foreign hangs forever
by madorb (Novice) on Jun 30, 2009 at 23:46 UTC
    Okay - i figured it out. I hadn't previously connected via the command line to the end server. So when i finally DID connect via the command line, i realized it was apparently, in the background hanging at:

    ben [~/deployscripts] n097719 $ sftp theservername Connecting to theservername... The authenticity of host 'theservername(xx.xxx.x.xx)' can't be establi +shed. RSA key fingerprint is 66:b3:58:c8:c3:af:62:0f:ea:41:43:b9:e9:ae:0a:6f +. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'theservername,xx.xxx.x.xx' (RSA) to the li +st of known hosts.


    So once the key was added via a command line connect... it works.