www.delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Subject: | Problems with cygwin, "expect" and ssh |
Date: | Wed, 24 May 2006 09:31:15 -0700 |
Message-ID: | <BD6B3BD6A3C3EC4FBC45FF024CE104370220D037@WAPRDVSEBE10.gsm1900.org> |
From: | "Stepp, Charles" <Charles DOT Stepp AT T-Mobile DOT com> |
To: | <cygwin AT cygwin DOT com> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id k4OGVSt5030087 |
I have found some interesting behavior regarding the cygwin expect/ssh problem. I used the little expect script That Corinna created. It seemed to not see the prompt for the password from the spawned ssh, so it just timed out. But, when I redirect the stderr to /dev/null, it behaves correctly. Perhaps ssh is spitting some spurious bytes to stderr that are causing the expect pattern to not match: ------------------------------------------------------------------------ GOOD: cstepp AT FLTAMLP0192593 ~ $ ./sshtest 2>/dev/null spawn ssh -t 10.65.16.41 Before expect for assword: cstepp AT 10 DOT 65 DOT 16 DOT 41's password: Found assword: Before send of password After send of password Last login: Thu Jan 01 1970 00:00:00 from [======================================================================] Use of this system is explicitly limited to employees... ------------------------------------------------------------------------ ----- BAD: cstepp AT abcdefghi ~ $ ./sshtest spawn ssh -t <hostname> Before expect for assword: cstepp AT 10 DOT 65 DOT 16 DOT 41's password: Spawning failed cstepp AT abcdefghi ~ ------------------------------------------------------------------------ ------- SCRIPT: cat sshtest #!/usr/bin/expect -f set timeout 10 spawn ssh -t <hostname> puts "Before expect for assword:" expect { "*assword:" { puts "Found assword:" sleep 2 } default { send_user "Spawning failed\n" exit } } puts "Before send of password" send "xxxxxxx\r" puts "After send of password" expect { -re ".*\\$.* " { } default { send_user "Sending password failed\n" exit } } send "ls\n" expect { -re ".*\\$.* " { } default { send_user "Sending ls failed\n" exit } } send "exit\n" expect { -re ".*Connection to mycygwinbox closed.*" { } default { send_user "Sending exit failed\n" exit } } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |