RE: [Ssh-sftp-perl-users] Anyone have an example of SSH2 to Cisco?
Brought to you by:
dbrobins
From: Mark F. <mf...@tr...> - 2006-05-15 19:40:10
|
Did you read my subject? Or just post a response? I changed the line to this: sub ssh2_cisco { my $ssh2 =3D Net::SSH2->new(); $ssh2->connect("$host1") or warn "Can't open connection to $host1\n"; $ssh2->auth_password($user1, $pass1); my $chan =3D $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=3D$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 =A0 Tivoli Certified Enterprise Consultant Specializing in Network and Systems Management Solutions Trinity Solutions=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 604 Cassandra Dr.=A0=A0=A0=A0=A0=A0=A0=20 Cranberry Twp., PA 16066 =A0 Phone: = 724-316-0721=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 Fax:=A0=A0=A0 724-772-7889=20 email: mf...@tr... http://www.trinitysol.net -----Original Message----- From: Matthew J. Salerno [mailto:vag...@ya...]=20 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 { >=20 > my $ssh2 =3D Net::SSH2->new(); >=20 > $ssh2->connect("$host1") or warn "Can't open > connection to $host1\n"; >=20 > $ssh2->auth_password($user1, $pass1); >=20 > my $chan =3D $ssh2->channel(); >=20 > #$chan->pty('terminal'); >=20 > $ssh2->exec('sh ver'); >=20 > } >=20 > =20 >=20 > root@tcpsyslog:/usr/local/scripts# ./ssh2.pl >=20 > exec is not a valid Net::SSH2 macro at ./ssh2.pl > line 44 >=20 > root@tcpsyslog:/usr/local/scripts# >=20 > =20 >=20 > =20 >=20 > 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. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around=20 http://mail.yahoo.com=20 |