Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: SFTP login problems

by salva (Abbot)
on May 03, 2012 at 11:00 UTC ( #968707=note: print w/ replies, xml ) Need Help??


in reply to SFTP login problems

Net::SFTP::Foreign (yes i know it's being depricated)

Before replying to your question let me clarify that Net::SFTP::Foreign is NOT being deprecated!!!

Now, can you show us your script, otherwise it is difficult to know what you are doing wrong.

Also, activate Net::SFTP::Foreign debugging inserting the following line at the beginning of your script:

$Net::SFTP::Foreign::debug = -1;
And post here the output you get when you run it after that.


Comment on Re: SFTP login problems
Download Code
Replies are listed 'Best First'.
Re^2: SFTP login problems
by chipchidster (Initiate) on May 03, 2012 at 11:34 UTC

    Yes, sorry - schoolboy error not to have posted the script code. So, amendments made to add the debug flag, the offending call is:

    # use the STEP param specified SFTP port printlog( "Opening an SFTP connection to $FTPaddress at port($SFTP +PORT)"); $ftp = Net::SFTP::Foreign->new($FTPaddress, user => $FTPuser, password => $FTPpasswd, port => $SFTPPORT, debug => $debug, more => [qw(-v -o PreferredAuth +entications=password)]

    The output of the log is:

    20120503 12:23:50 Step [50]: The old API for Net::SFTP::Foreign inherited from Net::SFTP is being o +bsoleted. Use Net::SFTP::Foreign::Compat for a package offering a mos +tly compatible API or upgrade to the development version of this pack +age and use the new and much improved API. at ********.pl line 252 20120503 12:23:51 SFTP: Will attempt to send (0) files to customer(man +age02.bds.tv) as user(proadmin), 20120503 12:23:51 SFTP: Opening an SFTP connection to ******** at port +(22) sftp: Sending SSH2_FXP_INIT OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to ******** [*******] port 22. debug1: Connection established. debug1: identity file /home/probatch/.ssh/identity type -1 debug1: identity file /home/probatch/.ssh/id_rsa type 1 debug1: identity file /home/probatch/.ssh/id_dsa type 2 debug1: loaded 3 keys debug1: Remote protocol version 2.0, remote software version OpenSSH_5 +.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host '********' is known and matches the RSA host key. debug1: Found key in /home/probatch/.ssh/known_hosts:33 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-keyex,gssa +pi-with-mic,password debug1: Next authentication method: password debug1: read_passphrase: can't open /dev/tty: No such device or addres +s debug1: Authentications that can continue: publickey,gssapi-keyex,gssa +pi-with-mic,password Permission denied, please try again. debug1: read_passphrase: can't open /dev/tty: No such device or addres +s debug1: Authentications that can continue: publickey,gssapi-keyex,gssa +pi-with-mic,password Permission denied, please try again. debug1: read_passphrase: can't open /dev/tty: No such device or addres +s debug1: Authentications that can continue: publickey,gssapi-keyex,gssa +pi-with-mic,password debug1: No more authentication methods to try. Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). reading from ssh pipe failed () at *****.pl line 252 20120503 12:23:51 Step [50] complete.

    As you can see from the warning at the top - that is why i assumed that Net::SFTP::Foreign was being depricated

      Whoa, you are using a version of Net::SFTP::Foreign on the 0.xx series that I stopped maintaining six years ago!!!

      Just install a recent version of the module.

        Dammit! looks like i must have a rogue module somewhere then. I've just done the following:

        sudo perl -MCPAN -e 'install Net::SFTP::Foreign' [sudo] password for purcedw1: Reading '/root/.cpan/Metadata' Database was generated on Wed, 02 May 2012 04:58:03 GMT Fetching with LWP: ftp://ftp.mirror.anlx.net/CPAN/authors/01mailrc.txt.gz Reading '/root/.cpan/sources/authors/01mailrc.txt.gz' ...................................................................... +......DONE Fetching with LWP: ftp://ftp.mirror.anlx.net/CPAN/modules/02packages.details.txt.gz Reading '/root/.cpan/sources/modules/02packages.details.txt.gz' Database was generated on Thu, 03 May 2012 11:15:03 GMT ...................................................................... +......DONE Fetching with LWP: ftp://ftp.mirror.anlx.net/CPAN/modules/03modlist.data.gz Reading '/root/.cpan/sources/modules/03modlist.data.gz' ...................................................................... +......DONE Writing /root/.cpan/Metadata Net::SFTP::Foreign is up to date (1.71).

        Thanks for the prompt reply - i shall confirm in due course :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968707]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2015-07-28 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls