in reply to Need Help on Net::SSH2 Module Usage on Windows
See A little demo for Net::SSH2.
As far as blocking and channels go, it's not simple, read perldoc Net::SSH2::Channel
If you want to exec something on the server, use this:
#!/usr/bin/perl use warnings; use strict; use Net::SSH2; my $pass = 'hahahaha'; my $ssh2 = Net::SSH2->new(); $ssh2->connect('localhost') or die "Unable to connect Host $@ \n"; #plain password login #$ssh2->auth_password('z','ztester') or die "Unable to login $@ \n"; # works when run from z's homedir because you need # permission to read the keys $ssh2->auth_publickey('zentara', '/home/zentara/.ssh/id_dsa.pub', '/home/zentara/.ssh/id_dsa', $pass ); my $chan = $ssh2->channel(); $chan->blocking(1); $chan->exec("nohup /home/zentara/perlplay/net/zzsleep > foo.out 2> foo +.err < /dev/null &"); $chan->send_eof; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need Help on Net::SSH2 Module Usage on Windows
by tarunmudgal4u (Sexton) on Aug 17, 2012 at 13:07 UTC | |
by zentara (Cardinal) on Aug 18, 2012 at 09:03 UTC | |
by tarunmudgal4u (Sexton) on Aug 22, 2012 at 12:19 UTC | |
by zentara (Cardinal) on Aug 22, 2012 at 16:03 UTC |