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

Re: Using IPC::Run to control ssh client

by Lightknight (Beadle)
on Sep 02, 2010 at 22:49 UTC ( [id://858644]=note: print w/replies, xml ) Need Help??


in reply to Using IPC::Run to control ssh client

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: note [id://858644]
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: (3)
As of 2024-04-26 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found