[wplug] ssh - reading password from stdin?

Bob Schmertz rschmertz at speakeasy.net
Thu Jul 10 19:40:42 EDT 2003


Timothy Wong incurred the wrath of Bob on Jul 10, by saying

>Hi everybody,
>
>Does anybody know if there is a way to force ssh (or telnet) to read the
>user's password from STDIN?  I would like to do this so that I can open an
>instance of ssh from perl a la "open (SSH, "| ssh myhost.com -l
>username")" and then using perl's print to control the ssh session.
>

This is the sort of thing Expect is for.  The original Expect is an 
extension of the Tcl programming language, but there is an Expect-like 
extension of Python, and I don't doubt there is one or several for Perl.  
Check freshmeat, or CPAN or whatever you Perl people do.

What Expect does is lets a program basically take over a terminal, and 
act as standard input or user-entered text as desired.  Cool stuff.

-- 
Cheers,
Bob Schmertz




More information about the wplug mailing list