Hello touriste75,

I would start with (How To Configure SSH Key-Based Authentication on a Linux Server).

Update: Forgot to say, by using SSH-keys you don't need to enter a password to connect to your remote host. Really you should do this even if you can use Perl modules.

As a second step a few days ago another Monk asked similar question, and he post a piece of code that seems to be working according to him (untested by me). Find more about it here (SSH and qx).

From the similar question (SSH and qx) as salva the author of Net::OpenSSH suggested: Net::OpenSSH is a pure Perl module. You just have to copy everything in the lib directory from the module distribution into some directory in the machine and add that directory into @INC to get it working..

Update2: In the past I had similar problems I tested any possible way of ssh, telnet modules that I could find. Take a look with working codes examples Best module to execute administrator commands on external operating systems (Linux).

Recently also another monk was asking for something similar (been able to SSH to multiple nodes). I created a working example for him with Net::OpenSSH::Parallel and the example is multiple machines disk space alert.

Similarly if you want to execute also SUDO commands, including example with working code Net::OpenSSH::Parallel with sudo commands.

Hope this helps, maybe to have another approach to your problem.

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re: SSH and expect without module by thanos1983
in thread SSH and expect without module by touriste75

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.