http://www.perlmonks.org?node_id=770570

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

I used net::SFTP in my program . My program is ,
use Net::SFTP ; $host = "hostName" ; %args = ( "user" => "vetri" , "password" => "vetri", "debug" => "true" ) ; my $sftp = Net::SFTP->new($host , %args); $sftp->put("2", "10");
I have perl5.6.1 and perl5.8.0 version . In perl5.8.0 It works fine . Here the mentioned the log .
Net::SSH::Perl Version 1.34, protocol version 2.0 No compat match: OpenSSH_4.3p2 Debian-9 Connection established. Sent key-exchange init (KEXINIT), wait response Algorithms, c->s: 3des-cbc hmac-sha1 none Algorithms, s->c: 3des-cbc +hmac-sha1 none Entering Diffie-Hellman Group 1 key exchange. Sent DH public key, waiting for reply. Received host key, type 'ssh-dss'. Host '192.168.1.130' is known and matches the host key. Computing shared secret key. Verifying server signature. Waiting for NEWKEYS message. Send NEWKEYS. Enabling encryption/MAC/compression. Sending request for user-authentication service. Service accepted: ssh-userauth. Trying empty user-authentication request. Authentication methods that can continue: publickey,password. Next method to try is publickey. Next method to try is password. Trying password authentication. Login completed, opening dummy shell channel. channel 0: new [client-session] Requesting channel_open for channel 0. channel 0: open confirm rwindow 0 rmax 32768 channel 1: new [client-session] Requesting channel_open for channel 1. Sending subsystem: sftp Requesting service subsystem on channel 1. channel 1: open confirm rwindow 0 rmax 32768 sftp: Sending SSH2_FXP_INIT sftp: Remote version: 3
But In perl5.6.1 I got segmentation Fault Error
Reading configuration data /root/.ssh/config Reading configuration data /etc/ssh_config Allocated local port 1023. Connecting to 192.168.1.130, port 22. Remote protocol version 2.0, remote software version OpenSSH_4.3p2 De +bian-9 Net::SSH::Perl Version 1.34, protocol version 2.0. No compat match: OpenSSH_4.3p2 Debian-9. Connection established. Sent key-exchange init (KEXINIT), wait response. Algorithms, c->s: 3des-cbc hmac-sha1 none Algorithms, s->c: 3des-cbc hmac-sha1 none Segmentation Fault .

20090612 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

Replies are listed 'Best First'.
Re: Net::SFTP in perl
by targetsmart (Curate) on Jun 11, 2009 at 09:07 UTC
    see Markup in the Monastery, did you see a preview of your post before posting ???
    It contains some of your client's name, :) I think like 'UBI-Chennai', avoid those things before posting

    Vivek
    -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
Re: Net::SFTP in perl
by derby (Abbot) on Jun 11, 2009 at 13:37 UTC

    Looks like a bad install of Net::SFTP for your 5.6.1 version of perl (which is a pretty ancient version of perl ... but then again, so is 5.8.0).

    -derby
      I have downloaded from CPAN . Sometimes it works fine . But most of the time I am getting segmentation fault error . Net-SFTP Version is Net-SFTP-0.10
Re: Net::SFTP in perl
by vek (Prior) on Jun 11, 2009 at 22:15 UTC
    Did Net::SFTP and thus Net::SSH::Perl install cleanly & pass tests on that 5.6.1 box? CPAN testers don't show any results for that old a version of Perl.
    -- vek --
Re: Net::SFTP in perl
by Khen1950fx (Canon) on Jun 12, 2009 at 05:32 UTC
    I've been working on this for awhile, and this is the best that I could come with:

    #!/usr/local/bin/perl use strict; use warnings; use Net::SFTP; my $host = '127.0.0.1'; my %args = ( user => 'vetri', password => 'vetri', debug => '1'); my $sftp = Net::SFTP->new( $host, %args ); $sftp->put('/place/to/start/at', '/place/to/put/file-to-put); exit;

    I hope this helps:-)

      Could you tell me your perl version .
        I use 5.8.8, shared and threaded.

      Have you tried your code in perl 5.6.1 version . Please check your code in perl5.6.1

        I installed 5.6.1 in a private directory; however, there where problems. I think that the problem you are having isn't with Net::SFTP but perl5.6.1. Is there anyway you can upgrade, because I really don't think that 5.6.1 will work right.