Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Using IPC::Run to control ssh client

by eisvogel (Initiate)
on Oct 25, 2000 at 01:24 UTC ( [id://38228]=perlquestion: print w/replies, xml ) Need Help??

eisvogel has asked for the wisdom of the Perl Monks concerning the following question:

How to use IPC::Run (with <pty redirect operator) and the batch-mode run routine to execute the ssh1 client, so that can write its stdin and read its stdout and stderr, as handles?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: Using IPC::Run to control ssh client
by lachoy (Parson) on Oct 25, 2000 at 04:35 UTC

    The Net::SSH module looks as if it might be useful.

Re: Using IPC::Run to control ssh client
by Lightknight (Beadle) on Sep 02, 2010 at 22:49 UTC

    For some reason, if we start ssh directly, ssh doesn't accept these ptys (and tries to launch ssh askpass). But if we start bash first, and from there launch ssh, it works.

    my $h = start ['bash'], '<pty<', \$in, '>pty>', \$outAndErr, timeo +ut(15); pump $h until $outAndErr =~ /$prompt/; $outAndErr=''; $in .= "ssh user\@host\n"; pump $h until $outAndErr =~ /password:/; $outAndErr=''; $in .= "password\n"; pump $h until $outAndErr =~ /$remotePrompt/; $outAndErr=''; # You're in - do your stuff
    Disclaimer: The original version of the above snippet works, but I've simplified it for this posting, and it is possible there are (minor) bugs in the above.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://38228]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2024-04-23 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found