I am using ssh to start to open a connection to a "service" account on a remote server. The remote account is configured to automatically start a process which reads a few lines (three, right now), processes the information and returns a status. That part works.

On the client side I am testing with:

use IPC:;Open2; my ($childin,$childout,$childerr); my $cmd = qq(/usr/bin/ssh -i $KEYFILE $USER\@$SERVER 2>/dev/null); my $pid = open2 ($childout,$childin,$cmd); my $status = $!; # check for success here # send commands print $childin $line1 print $childin $line2 print $childin $line3 etc...

That works but if there is a "better" way I'd like to know. I tried with Net::SSH::Perl but couldn't get it to work with the remote server starting the command. Maybe I am overlooking something.

The application is intended to allow a user to reset and change his or her Kerberos password from a web interface. The web server does not run on the Authentication Server or KDC.


In reply to Connecting to STDIN and STDOUT over SSH by enemyofthestate

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.