Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Net::SFTP in perl

by vetrivel (Sexton)
on Jun 11, 2009 at 09:04 UTC ( #770570=perlquestion: print w/replies, xml ) Need Help??
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 '' 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, 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

    -- 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).

      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 = ''; 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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://770570]
Approved by targetsmart
[Corion]: Meh. Some Open Source people get bought out by advertising firms to change their projects to include advertising. But nobody has approached me to buy out WWW::Mechanize ::$browser from me, to make the browsers launch an ad page ...
[Corion]: ... instead of about:blank, which the modules currently do at startup.
[Corion]: Maybe I'm too pricey. But I haven't received any offers at all ;-)
[Corion]: The ad hits from CPAN testers alone should bring in a pretty penny IMO. But maybe I misestimate the CPC that ads pay.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-07-24 14:18 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (354 votes). Check out past polls.