in reply to Re^2: Can't connect using Password with Net::SFTP::Foreign
in thread Can't connect using Password with Net::SFTP::Foreign

The debug message is the same output:
# queueing msg len: 5, code:1, id:3 ... [1] 00 00 00 05 01 00 00 00 03 # waiting for message... [1] connection failed: bad remote message received
I read in another thread there was a known issue in versions previous to 1.37 of this package that the expect module suddenly would drop connections so I was suspicious of that but I don't seem to be getting that error or I'm not making it that far. It appears we are on version 1.31 so I have asked our admin's to upgrade this module to the current version to see if that helps. I apologize for my ignorance but I am relatively new to PERL so this is a big learning experience for me.

Replies are listed 'Best First'.
Re^4: Can't connect using Password with Net::SFTP::Foreign
by salva (Canon) on May 04, 2009 at 15:26 UTC
    The debug message is the same output:
    # queueing msg len: 5, code:1, id:3 ... [1] 00 00 00 05 01 00 00 00 03 # waiting for message... [1] connection failed: bad remote message received

    That probably means Net::SFTP::Foreign thinks the authentication is over but it is not! Are you using the correct password?

    Support for password authentication in Net::SFTP::Foreign has some limitations (for instace, it can't detect a bad password) because the ssh client used behind the scenes was not designed to be automated in that way.

    In any case, upgrading to the latest version will probably make your problem disappear or alternatively, if you can, switch to public key authentication.

    If everything else fails, install version 1.52_03 of the module that I have just uploaded to CPAN, rerun your script setting Net::SFTP::Foreign::debug = -1, and post the full debugging output.

      Thanks so much for your input. It is the correct password because I printed out the password in one of my tests as well as the password length to ensure there are no unseen characters there. Once they install the new version I will see where it goes. Thanks again!
        Well the admin upgraded our package to version 1.51 and I reran the script with debugging output set to -1 and received the following results:
        OpenSSH_3.9, OpenSSL 0.9.7d 17 Mar 2004 HP-UX Secure Shell-A.03.91.009, HP-UX Secure Shell version debug1: Reading configuration data /opt/ssh/etc/ssh_config debug1: Connecting to 172.19.1.47 [172.19.1.47] port 22. debug1: Connection established. debug1: identity file /opt/informatica/powercenter/server/infa_shared/ +SrcFiles//.ssh/id_rsa type -1 debug1: identity file /opt/informatica/powercenter/server/infa_shared/ +SrcFiles//.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version 1.36_sshl +ib GlobalSCAPE debug1: no match: 1.36_sshlib GlobalSCAPE debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.9 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client 3des-cbc hmac-md5 none debug1: kex: client->server 3des-cbc hmac-md5 none debug1: sending SSH2_MSG_KEXDH_INIT debug1: expecting SSH2_MSG_KEXDH_REPLY #9516 queueing msg len: 5, code:1, id:3 ... [1] 00 00 00 05 01 00 00 00 03 + | ......... #9516 waiting for message... [1] #9516 _do_io connected: 1 #9516 _do_io select(-,-,-, undef) #9516 _do_io write queue: 9, syswrite: 9, max: 20480 #9516 _do_io select(-,-,-, undef)
        It also seems to hang at this point on a blank command line.