This is totally not a Perl answer and not an answer to your direct question, but hopefully it will solve your problem.

You should be using a public/private key pair to enable login without using a password. It's arguably more secure, and once you get it working you'll wonder how you ever got along without it.

These instructions are for a Un*x like environment, this is entirely possible under Windows too. If you don't currently have an id_*.pub in the .ssh under your home directory, run "ssh-keygen" to create one. Your remote systems also have a ~/.ssh directory, which should be chmod 0700. Append the id_*.pub (by default, id_rsa.pub) file from your client machine (where you're running this Perl) to ~/.ssh/authorized_keys on your server machine (if it doesn't exist yet, create it).

Now you can ssh and scp from your client machine to your server without having to enter a password, and you can make the password on the server devilishly difficult and long because you no longer have to remember it, and the chances of someone brute forcing it or looking over your shoulder and seeing you type it goes way down.

And you're not storing your password in plain text in a Perl script, and you can bypass this problem.


In reply to Re: Expect and CSSH by danlyke
in thread Expect and CSSH by Monkless

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.