Hi All,

It's me again... the backup guy... I'm developing the cross platfrom simplebackup program (http://migas.kicks-ass.org/index.php?pag=en.myapps&subpag=simplebackup)

Right now i'm adding the final new feature secure ftp...

Under windows i have made it work by using the putty psftp.exe program.

Under unix i want to use the perl modules Net::SFTP and Net::SSH2... if the user has Net::SSH2 then use that module if not use Net::SFTP.


My actual question... Net::SFTP DOES NOT WORK... it is unable to use username/password authentication
here is the code...
my $special_error_flag = 0; $network_debug_level_real = 2; $network_username = "root"; $password = "root password"; my %ssh_config = ( port => $network_server_port, ); my %sftp_config = ( user => $network_username, password => $network_password, debug => $network_debug_level_real +, ssh_args => \%ssh_config, ); eval { $$network_connection_p = Net::SFTP->new($network_se +rver, %sftp_config ) or $special_error_flag = 1; }; if ( $@ ) { # sftp connection failure $$network_connection_p = (); print "Connection failed\n"; } print "special_error_flag $special_error_flag\n"; if ( $special_error_flag == 0 ) { print "login"; my @listings = $$network_connection_p->ls("/root" +); foreach my $teste ( @listings ) { print "teste $teste\n"; } } <

here is the log
migas: Reading configuration data /root/.ssh/config migas: Reading configuration data /etc/ssh_config migas: Allocated local port 1023. migas: Connecting to localhost, port 443. migas: Remote version string: SSH-1.99-OpenSSH_3.9p1 migas: Remote protocol version 1.99, remote software version OpenSSH_3 +.9p1 migas: Net::SSH::Perl Version 1.30, protocol version 2.0. migas: No compat match: OpenSSH_3.9p1. migas: Connection established. migas: Sent key-exchange init (KEXINIT), wait response. migas: Algorithms, c->s: 3des-cbc hmac-sha1 none migas: Algorithms, s->c: 3des-cbc hmac-sha1 none migas: Entering Diffie-Hellman Group 1 key exchange. migas: Sent DH public key, waiting for reply. migas: Received host key, type 'ssh-dss'. migas: Host 'localhost' is known and matches the host key. migas: Computing shared secret key. migas: Verifying server signature. migas: Waiting for NEWKEYS message. migas: Enabling incoming encryption/MAC/compression. migas: Send NEWKEYS, enable outgoing encryption/MAC/compression. migas: Sending request for user-authentication service. migas: Service accepted: ssh-userauth. migas: Trying empty user-authentication request. migas: Authentication methods that can continue: publickey,keyboard-in +teractive. migas: Next method to try is publickey.

Does anyone has a clue ? thanks in advanded !
PS: Hope you try out my simplebackup program, it's open source.

Migas - Miguel

In reply to Net::SFTP HELP.... by migas

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.