[wplug] ssh - reading password from stdin?
Kuzman Ganchev
kuzman at sccs.swarthmore.edu
Thu Jul 10 21:19:08 EDT 2003
On Thu, Jul 10, 2003 at 01:09:42AM -0400, Timothy Wong wrote:
> 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.
Sounds like what you want is ssh-agent(1). I think that ssh is pretty
picky about taking passwords from what it thinks isn't a human,
because storing passwords is a bad idea[1]. If you want this to run
from cron or similar then use a null passphrase key, rather than
storing the password in a file -- it's not less secure.
I know system that uses this to transmit /etc/passwd and /etc/shadow
to client machines.
> 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?
Apparently not. From perlfunc:
If the filename begins with '|', the filename is interpreted as a
command to which output is to be piped, and if the filename ends with
a '|', the filename is interpreted as a command which pipes output to
us. See Using open() for IPC in the perlipc manpage for more examples
of this. (You are not allowed to open to a command that pipes both in
and out, but see the IPC::Open2 manpage, the IPC::Open3 manpage, and
Bidirectional Communication with Another Process in the perlipc
manpage for alternatives.)
I didn't read the perlipc manual.
Kuzman
More information about the wplug
mailing list