sintoad has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use Net::SSH2; my $buflen = 100; my $buf = '0' x $buflen; my $ssh2 = Net::SSH2->new(); $ssh2->connect('10.1.1.85','22') or die; #$ssh2->debug(1); $ssh2->auth_publickey('root','pub.pub','priv.ppk','toor') or die "Unable to login $! \n"; my $chan1 = $ssh2->channel(); $chan1->blocking(1); $chan1->exec('df'); $chan1->read($buf, $buflen); print "BUF: ", $buf, "\n"; $chan1->close; #my $chan2 = $ssh2->channel(); #$chan2->blocking(1); #$chan2->exec('echo $HOME'); #$chan2->read($buf, $buflen); #print "BUF: ", $buf, "\n"; #$chan2->close; system ("pause");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: net::ssh2 connection
by almut (Canon) on Nov 03, 2008 at 19:44 UTC | |
by sintoad (Initiate) on Nov 03, 2008 at 19:53 UTC | |
by sintoad (Initiate) on Nov 03, 2008 at 20:31 UTC | |
by syphilis (Archbishop) on Nov 03, 2008 at 23:28 UTC | |
by Anonymous Monk on Nov 04, 2008 at 11:13 UTC | |
by Anonymous Monk on Nov 04, 2008 at 17:00 UTC | |
|