RE: [Ssh-sftp-perl-users] Anyone have an example of SSH2 to Cisco?
Brought to you by:
dbrobins
From: Matthew J. S. <vag...@ya...> - 2006-05-15 20:30:55
|
--- Mark Funk <mf...@tr...> wrote: > Did you read my subject? Or just post a response? > > I changed the line to this: > sub ssh2_cisco { > my $ssh2 = Net::SSH2->new(); > $ssh2->connect("$host1") or warn "Can't open > connection to $host1\n"; > $ssh2->auth_password($user1, $pass1); > my $chan = $ssh2->channel(); > # using exec to execute a command > $chan->exec('sh ver'); > <---------------------------------- > print "EXEC : $_" while <$chan>; > > # don't forget to close since you can do only 1 > exec > $chan->close; > # writing to a channel > # a new channel, remember the last one is closed > my $chan=$ssh2->channel(); > $chan->shell(); > print $chan "sh ver\n"; > > > root@tcpsyslog:/usr/local/scripts# > root@tcpsyslog:/usr/local/scripts# > root@tcpsyslog:/usr/local/scripts# > root@tcpsyslog:/usr/local/scripts# ./ssh2.pl Can't > call method "exec" on an > undefined value at ./ssh2.pl line 44. > root@tcpsyslog:/usr/local/scripts# > > But I still get an error............ > > > >Read the docs. There is no reference to exec. > Your > >e-mail is not even asking a question! > > >http://search.cpan.org/~dbrobins/Net-SSH-Perl-1.30/lib/Net/SSH/Perl.pm > > >Look at the given example. > > > Also, the doc reference you replied back with is for > SSH not SSH2! > > > > David M. Funk > President/CEO > � > > > -----Original Message----- > From: Matthew J. Salerno > [mailto:vag...@ya...] > Sent: Monday, May 15, 2006 3:27 PM > To: Mark Funk; > ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Anyone have an > example of SSH2 to Cisco? > > --- Mark Funk <mf...@tr...> wrote: > > > sub ssh2_cisco { > > > > my $ssh2 = Net::SSH2->new(); > > > > $ssh2->connect("$host1") or warn "Can't open > > connection to $host1\n"; > > > > $ssh2->auth_password($user1, $pass1); > > > > my $chan = $ssh2->channel(); > > > > #$chan->pty('terminal'); > > > > $ssh2->exec('sh ver'); > > > > } > > > > > > > > root@tcpsyslog:/usr/local/scripts# ./ssh2.pl > > > > exec is not a valid Net::SSH2 macro at ./ssh2.pl > > line 44 > > > > root@tcpsyslog:/usr/local/scripts# > > > > > > > > > > > > Thanks, > > Did you read the error message or just post it? > > "exec is not a valid Net::SSH2 macro at ./ssh2.pl > line > 44" > > Read the docs. There is no reference to exec. Your > e-mail is not even asking a question! > > http://search.cpan.org/~dbrobins/Net-SSH-Perl-1.30/lib/Net/SSH/Perl.pm > > Look at the given example. > > __________________________________________________ I have to admit, I just skimmed the subject and read the body, which is where most people post their questions. I would recommend looking at the source code and mailing list archives. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |