Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am new to perl programming i am trying to implementing a small code using Net::SSH2. I am trying to connect to one of my local machine & retrive the hostname of that machine using Net::SSH2 module, whenever i try executing the program then i just get hanged-up without any ouput.
use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect('machine') or die " Cannot connect to 219 "; $ssh2->auth_password('username','password') or die " username/password + is wrong "; print "Username/Password is correct\n"; my $chan2 = $ssh2->channel(); $chan2->shell(); print $chan2 "hostname -a\n"; print "LINE : $_" while <$chan2>; $chan2->close;
I want to know whether I am missing any points in implementing the logic.
Thanks in advance
pradeep
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SSH2 just hangs up without any output
by syphilis (Archbishop) on Aug 28, 2007 at 10:46 UTC | |
by Anonymous Monk on Aug 28, 2007 at 14:57 UTC | |
|
Re: Net::SSH2 just hangs up without any output
by zentara (Cardinal) on Aug 28, 2007 at 12:45 UTC | |
|
Re: Net::SSH2 just hangs up without any output
by Anonymous Monk on Aug 28, 2007 at 10:16 UTC |