... it seems it do not have reference to the script and can perform any other line of code after doing ssh to the specific server ...

In the absence of detailed info, I'll make a few assumptions and have some fun guessing :-)

If your script simply uses the ssh command to execute shell commands, Perl isn't really the challenge but rather how good you are at extracting information using shell one-liners. Then you can process that information in your local Perl script.

If, on the other hand, you are trying to remote into a host using ssh to execute a local copy of a Perl script, you will first have to make sure a local copy of that Perl script exists on the remote host. You will probably want to look into both "scp" (copy files via SSH)."

In either case, you'll probably want to look into how to set up password-less (key based) SSH authentication so you won't have to deal with password prompts etc. But please make sure you understand the security implications of allowing password-less authentication. I'm not saying it's worse than hard-coding passwords in a script, but you have to think it through all the same.

-- FloydATC

Time flies when you don't know what you're doing


In reply to Re: Execute Perl script on Remote server without any CPAN module by FloydATC
in thread Execute Perl script on Remote server without any CPAN module by kotak86

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.