[Ssh-sftp-perl-users] net::ssh2 perl small program wanted!!!!
Brought to you by:
dbrobins
From: Ibrahim S. <sal...@gm...> - 2008-05-07 19:52:15
|
Hello everybody, i need urgently an net::ssh2 perl small program that connects to a router and execute one command and display its output in the sceen. i wrote one but it didn t give me the result i need: #!/usr/bin/perl -w # use warnings and strict to force neat coding, # and prevent bugs in the future use strict; use Net::SSH2; my $remotehost="kdca-guard-agm1"; my $login="reports"; my $password="wvyonfr5"; my $chan; # creating the ssh2 object my $ssh2 = Net::SSH2->new(); # connecting and logging in to the machine die "connect fail" unless ($ssh2->connect($remotehost)); die "password fail" unless ($ssh2->auth_password($login,$password)); $chan=$ssh2->channel(); $chan->exec("sh ver\n"); print "EXEC : $_" while <$chan>; $chan->close; print "connected\n"; the favor ll be returned best regards, thank you |