in reply to Printing Output From Net::SSH2 exec
The module needs a recent version of OpenSSH (4.2 or later, 5.2 recomended) installed on your system and does not work under Windows.use Net::OpenSSH; my $ssh = Net::OpenSSH->new($remote_host, user => $remote_user, passwo +rd => $password); $ssh->error and die "Unable to connect to $remote_host: " . $ssh->erro +r; my $fh = $ssh->pipe_out('ls -la /Users/vortura') or die "unable to run command: " . $ssh->error; while (<$fh>) { print "OUT: $_"; } close $fh or die "close failed: $?";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing Output From Net::SSH2 exec
by vortura (Initiate) on May 14, 2009 at 10:48 UTC | |
by salva (Canon) on May 14, 2009 at 11:20 UTC |