K
Krishna Chaitanya
Hi,
Am trying to use scp_put on an Net::SSH2 object but it fails thus:
====================
Listing 1.pl
---------------
#!/usr/bin/perl
use warnings;
use strict;
use Net::SSH2;
my $ssh2 = Net::SSH2->new();
$ssh2->connect('10.0.1.174') or die;
if ($ssh2->auth_password('inmdev','inmdev')) {
print "Authorization successful\n";
my $chan2 = $ssh2->channel();
$chan2->shell();
$chan2->blocking(0);
print $chan2 "uname -a\n";
print "LINE : $_" while <$chan2>;
$chan2->close();
$ssh2->scp_put("/home/perl_progs/2.pl") or warn "Could not scp
the file 2.pl ";
} else {
print "Authorization failure\n";
}
====================
Output is :
Authorization successful
LINE : Linux IMITS174.localdomain 2.6.9-42.ELsmp #1 SMP Wed Jul 12
23:27:17 EDT 2006 i686 i686 i386 GNU/Linux
Could not scp the file 2.pl at 1.pl line 20.
I've seen source of Net/SSH2.pm on this Linux box and the sub scp_put
has these lines:
my $chan = $self->_scp_put($remote, $mode, @stat[7, 8, 9]);
return unless $chan;
$chan->blocking(1);
There is no such function as _scp_put in this module or elsewhere on
my Linux box (I found out by find with -exec grep). What do I do in
this case? I tried running this program through perl -d and it failed
at this line.
Pls. help. Many thanks in advance.
-Chaitanya
Am trying to use scp_put on an Net::SSH2 object but it fails thus:
====================
Listing 1.pl
---------------
#!/usr/bin/perl
use warnings;
use strict;
use Net::SSH2;
my $ssh2 = Net::SSH2->new();
$ssh2->connect('10.0.1.174') or die;
if ($ssh2->auth_password('inmdev','inmdev')) {
print "Authorization successful\n";
my $chan2 = $ssh2->channel();
$chan2->shell();
$chan2->blocking(0);
print $chan2 "uname -a\n";
print "LINE : $_" while <$chan2>;
$chan2->close();
$ssh2->scp_put("/home/perl_progs/2.pl") or warn "Could not scp
the file 2.pl ";
} else {
print "Authorization failure\n";
}
====================
Output is :
Authorization successful
LINE : Linux IMITS174.localdomain 2.6.9-42.ELsmp #1 SMP Wed Jul 12
23:27:17 EDT 2006 i686 i686 i386 GNU/Linux
Could not scp the file 2.pl at 1.pl line 20.
I've seen source of Net/SSH2.pm on this Linux box and the sub scp_put
has these lines:
my $chan = $self->_scp_put($remote, $mode, @stat[7, 8, 9]);
return unless $chan;
$chan->blocking(1);
There is no such function as _scp_put in this module or elsewhere on
my Linux box (I found out by find with -exec grep). What do I do in
this case? I tried running this program through perl -d and it failed
at this line.
Pls. help. Many thanks in advance.
-Chaitanya