[wplug] ssh - reading password from stdin?

Jonathan S. Billings billings at negate.org
Thu Jul 10 22:17:11 EDT 2003


On Thursday, Jul 10, 2003, at 01:09 America/New_York, Timothy Wong 
wrote:

> 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.

If this were anything other than opening a ssh or telnet session, I'd 
reccomend IPC::Open2 (gives you stdin and stdout) or IPC::Open3 (stdin, 
stdout and stderr).  In this case, I'd definately suggest you use SSH's 
ssh-agent capabilities to remove any passwords.

> Another issue that presents itself is how to read from this instance of
> SSH...I can write to it, but I can't specify two pipes in the open
> statement...can I?

That's what you'd use IPC::Open2, you get distinct filehandles for each.

--
   Jonathan Billings
billings at negate.org




More information about the wplug mailing list