Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: best method in perl to execute command on remote server and fetch its output

by moritz (Cardinal)
on May 24, 2015 at 13:09 UTC ( #1127584=note: print w/replies, xml ) Need Help??


in reply to best method in perl to execute command on remote server and fetch its output

Regardless of the programming language you use, and regardless of questions of convenience, you should use ssh. In contrast to both rsh and telnet, it can be secure.

On the perl side of things, Net::OpenSSH has a pretty good reputation. It's ->capture method lets you retrieve the output of a remote command, so it seems to fit your requirements.

  • Comment on Re: best method in perl to execute command on remote server and fetch its output
  • Download Code

Replies are listed 'Best First'.
Re^2: best method in perl to execute command on remote server and fetch its output
by janasec (Sexton) on May 24, 2015 at 14:46 UTC

    thanks for the quick reply

    please can you simple give a working example using the module Net::OpenSSH ,I checked the perldoc for the same but could not find a solution to ssh with username and password and run the command and gather output

    Thanks in advance

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1127584]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2020-05-30 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (171 votes). Check out past polls.

    Notices?