Hi Salva, thanks for your reply. I've read through the documentation for OpenSSH and it seems like a much better method than my current attempts. I'm getting really confused though with the examples in the documentation, and my own attempts aren't going well. Would you be able to help further? My current code sample is below.

#!/usr/bin/perl -wT use Net::OpenSSH; $ENV{PATH} = "/bin"; my $ssh = Net::OpenSSH->new("<IP>", user => "<username>", password => +"<password>"); $ssh->error and die "Can't ssh to host: " . $ssh->error; $ssh->system('whoami')or die "whoami failed: " .$ssh->error;

I should say, I have tried this without the password bit (as I use private key authentication) as well, and I have tried using syntax such as  my $ssh = Net::OpenSSH->new("<user>\@<Host IP>");.
I get the following error:

Can't exec "ssh": No such file or directory at /usr/share/perl5/Net/Op +enSSH.pm line 731. Can't ssh to host: unable to establish master SSH connection: master p +rocess exited unexpectedly
Do you have any further advice?
Thanks very much again! Really appreciate your help.


In reply to Re^2: Using SSH and SCP in a perl script with taint flag by stefl
in thread Using SSH and SCP in a perl script with taint flag by stefl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.