X-Spam-Check-By: sourceware.org Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: Problems with cygwin, "expect" and ssh Date: Wed, 24 May 2006 09:31:15 -0700 Message-ID: From: "Stepp, Charles" To: Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit 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 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 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/