If the requirement really is an arbitrary number of machines, the only way you can avoid keeping it in memory is to switch to a non-password based authentication. The program will need the password whenever it has to login so your options are really either to keep the password around or open all the connections up front (which doesn't work with an arbritrary number, but could be an option if your requirements are actually fewer machines). By opening all the connections up front you can then discard the password that was in memory (and hope none of the connections dies so you require it again). What you should really look at though is if there are alternative ways to accomplish the goal, things like ssh keys and kerberos can allow you to access machines without keeping passwords around.


We're not surrounded, we're in a target-rich environment!

In reply to Re: hiding passwords by jasonk
in thread hiding passwords by jfroebe

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.