On 03/11/2006, at 4:15 PM, Gonzalo Servat wrote:
...
Since Expect needs to either spawn a program or access a FH,
Net::SSH::Perl no longer suited my needs. I started to look into
spawning SSH from Net::Telnet, then using Expect on the Net::Telnet
object.
After looking at the man page for Net::Telnet, I found the SSH
example. I copied and pasted exactly how it is and it was impossible
to get it to work. It would connect to the remote server, but the
program could never get the password prompt. It would see the
permission denied messages, but NOT the password prompt. After some
more reading tonight I discovered that, for security reasons, SSH
writes to the controlling TTY, but with the Net::Telnet SSH example it
should work as it is creating a PTY to do just that.
Anyway, I did some more researching and found this excellent resource:
http://www.modperl.com/perl_networking/sample/ch6.html
Once again, I copied and pasted the code exactly as it is there, ran
it and same problem. It can't see the password prompt that the SSH
program is sending to the TTY!
I'm pretty damn sure it is the fact that SSH is sending the password
prompt to the TTY and Perl's PTY is not receiving it. Why? I don't
know !!
Could it be because the ssh password prompt is being written to
standard error, rather than standard output?
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html