For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > SFTP problems...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SFTP problems...
Ing. Branislav Gerzo

2005-03-22, 3:56 pm

Hello beginners@perl.org,

I just install Net::SFTP on my machine via PPM (randy kobes
repository), and ran this code:

#!/usr/bin/perl -w
use strict;
use warnings;
use Net::SFTP;

my $host = '11.11.111.11';
my $user = 'root';
my $pass = '*********';

my $sftp = Net::SFTP->new($host,user =>$user,
password=>$pass,
debug =>1,
ssh_args=>[port=>22] ) || die "Can't connect $@\n";
print "Connected\n";

__END__

gives me strange output:

branog: Reading configuration data /.ssh/config
branog: Reading configuration data /etc/ssh_config
branog: Connecting to 66.98.212.99, port 22.
branog: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
branog: Net::SSH::Perl Version 1.25, protocol version 2.0.
Use of uninitialized value in concatenation (.) or string at D:/Perl/site/lib/Ne
t/SSH/Perl/SSH2.pm line 41, <GEN0> line 1.
Use of uninitialized value in concatenation (.) or string at D:/Perl/site/lib/Ne
t/SSH/Perl/SSH2.pm line 47, <GEN0> line 1.
branog: No compat match: OpenSSH_3.9p1.
Your vendor has not defined Fcntl macro F_SETFL, used at D:/Perl/site/lib/Net/SS
H/Perl.pm line 214.

it seems, I don't have /.ssh/config nor /etc/ssh_config, but I don't
think this is causing error. Line 41 from SSH2 is:
$ssh->{config}->set('identity_files', [ "$ENV{HOME}/.ssh/id_dsa" ]);

si I put infront on my script:
$ENV{HOME} = '';

now, I don't get 'Use of uninitaialized value...' errors, but last
error still remain.

line 214 from Perl.pm is:
fcntl($sock, F_SETFL, O_NONBLOCK)
or die "Can't set socket non-blocking: $!";

but this I really don't know how to cheat it...

Also, when I think about this, main errors are these:
branog: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
branog: No compat match: OpenSSH_3.9p1.

so it seems, local SSH can't comunicate with remote version of SSH
(I'm right?). Where I can find list of supported SSH versions (so I
should add this one:)

--

--. ,-- ,- ICQ: 7552083 \|||/ `//EB: www.2ge.us
,--' | - |-- IRC: [2ge] (. .) ,\\SN: 2ge!2ge_us
`====+==+=+===~ ~=============-o00-(_)-00o-================~
* <- Tribble (*) <- Tribble with shields up




Zentara

2005-03-23, 3:56 pm

On Tue, 22 Mar 2005 16:12:27 +0100, konfera@2ge.us (Ing. Branislav
Gerzo) wrote:
>
>I just install Net::SFTP on my machine via PPM (randy kobes
>repository), and ran this code:


>gives me strange output:
>
>branog: Reading configuration data /.ssh/config
>branog: Reading configuration data /etc/ssh_config
>branog: Connecting to 66.98.212.99, port 22.
>branog: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
>branog: Net::SSH::Perl Version 1.25, protocol version 2.0.


>it seems, I don't have /.ssh/config nor /etc/ssh_config, but I don't
>think this is causing error. Line 41 from SSH2 is:
>$ssh->{config}->set('identity_files', [ "$ENV{HOME}/.ssh/id_dsa" ]);


>
>Also, when I think about this, main errors are these:
>branog: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
>branog: No compat match: OpenSSH_3.9p1.
>
>so it seems, local SSH can't comunicate with remote version of SSH
>(I'm right?). Where I can find list of supported SSH versions (so I
>should add this one:)


Yeah, it looks like the server is version 1 of ssh, while you are
running ssh2 on your client.

You could try adding a
protocol => 1,2

to your %args . Adding ssh options to sftp can be a little
tricky, here is one way to do it. Untested (and I don't have windows)

########################################
################
my %ssh_options = (
protocol => 1,2
);

my %args = (
username => $user,
password => $pass,
debug => 1,
ssh_args => (options => \%ssh_options)
);

my $sftp = Net::SFTP->new($host, %args)

########################################
###############

Goodluck. Googling for answers might help.



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Ing. Branislav Gerzo

2005-03-23, 3:56 pm

zentara [z], on Wednesday, March 23, 2005 at 10:10 (-0500) thinks
about :

z> Yeah, it looks like the server is version 1 of ssh, while you are
z> running ssh2 on your client.

now everything works under win32. The SFTP under win is tricky thing,
but it seems, it works good.

problem was original Net::SFTP which calls NET::SSH::Perl

--

...m8s, cu l8r, Brano.

["COOL!! THIS RULES!" -Beavis and Butthead on Urotsukidoji]


mgoland@optonline.net

2005-03-23, 8:55 pm



----- Original Message -----
From: "Ing. Branislav Gerzo" <konfera@2ge.us>
Date: Wednesday, March 23, 2005 11:10 am
Subject: Re: SFTP problems...

> zentara [z], on Wednesday, March 23, 2005 at 10:10 (-0500) thinks
> about :
>
> z> Yeah, it looks like the server is version 1 of ssh, while you are
> z> running ssh2 on your client.
>
> now everything works under win32. The SFTP under win is tricky thing,
> but it seems, it works good.
>
> problem was original Net::SFTP which calls NET::SSH::Perl

You should use the SSH WIN32 port on all windows platforms. Or else it can get UGLY !!

just my $0.01 USD


>
> --
>
> ...m8s, cu l8r, Brano.
>
> ["COOL!! THIS RULES!" -Beavis and Butthead on Urotsukidoji]
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com