Message-Id: <200105311626.MAA00732@delorie.com> Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Mark Paulus" To: "cygwin AT cygwin DOT com" Date: Thu, 31 May 2001 10:24:14 -0600 Reply-To: "Mark Paulus" X-Mailer: PMMail 2000 Professional (2.20.2350) For Windows 2000 (5.0.2195;2) In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: RE: Calling SSH from Expect - URGENT Is WS007594 a Win/cygwin box, or a straight linux box?? I can not get the expect script to work under cygwin, but it does run under debian/linux. That is why I suspect that either the cygwin version of ssh isn't playing nice, or the cygwin version of expect isn't attaching to the ssh stdin correctly. I don't know if I will have more time to debug, but I might look into it later. On Thu, 31 May 2001 11:37:04 -0400, Simha, Shuba wrote: >The very same does not work for me !!! Here's the output from my session.. > >admin AT WS007594 ~/scripts >$ cat connect_ws >#!/usr/bin/expect -f >spawn /bin/ssh -l username -p 1010 hostname "ls -l" >expect -re "Enter passphrase for RSA key '.*': " >send "shuba\r" >expect eof > > >admin AT WS007594 ~/scripts >$ ./connect_ws >spawn /bin/ssh -l username -p 1010 hostname ls -l >Enter passphrase for RSA key 'admin AT WS007594': shuba > > No output !! > > >admin AT WS007594 ~/scripts >$ callconn.pl connect_ws ftp-rfc shellscript try >cfile.c connect_ws~ perlfile.pl shellscript1 > > I typed ls - not echoed > >admin AT WS007594 ~/scripts >$ This is not seen > > I typed echo This is not seen - The command is invisible !! > >admin AT WS007594 ~/scripts >$ > > >-----Original Message----- >From: Mark Paulus [mailto:commpg AT yahoo DOT com] >Sent: Thursday, May 31, 2001 10:36 AM >To: cygwin AT cygwin DOT com >Subject: Re: Calling SSH from Expect - URGENT > > >I believe this is a problem with the way tty's are handled under cygwin. >I tried this script on a friend's debian box, and it also works as expected. > >I think what's going on here is that somehow the ssh's stdin is getting >"disconnected" from the expect terminal (I don't know whether the >problem is expect's or ssh's though). This is evidenced by the fact that >you are seeing the password that expect is typing. Expect is typing >the password into a standard stream, no a password enabled, character >hiding stream such as ssh would be using. I have enclosed the output >from my test session from debian, and you can see that there is no >password. > > >mpaulus AT csu6223286:~ >$ ./doit >spawn /usr/bin/ssh -l mgpaulus 24.221.196.205 ls -l >mgpaulus AT 24 DOT 221 DOT 196 DOT 205's password: >total 1356 >drwxr-sr-x 2 mgpaulus mgpaulus 4096 Mar 12 23:35 News >drwxr-sr-x 2 mgpaulus mgpaulus 4096 Mar 8 23:13 bin >-rw-r--r-- 1 mgpaulus mgpaulus 6366 May 1 08:18 >caching-nameserver-7.1-3 >.noarch.rpm >drwxr-sr-x 8 mgpaulus mgpaulus 4096 Mar 30 13:17 fetchmail-5.3.3 >-rwxr-xr-x 1 mgpaulus mgpaulus 23953 Mar 30 13:01 >fetchmail_5.3.3-1.1.diff >.gz >-rwxr-xr-x 1 mgpaulus mgpaulus 755731 Mar 30 13:02 >fetchmail_5.3.3.orig.tar >.gz >-rw-r--r-- 1 mgpaulus mgpaulus 352 May 22 14:56 identity.vpn.pub >-rw-r--r-- 1 mgpaulus mgpaulus 61 Mar 8 23:18 make.log >-rw-r--r-- 1 mgpaulus mgpaulus 2295 Mar 7 12:14 mpaulus.htm >drwx--S--- 2 mgpaulus mgpaulus 4096 Feb 15 07:46 nsmail >drwxr-sr-x 16 mgpaulus mgpaulus 4096 May 9 15:28 ppp-2.4.1 >-rw-r--r-- 1 mgpaulus mgpaulus 536746 May 9 15:27 ppp-2.4.1.tar.gz >-rw-r--r-- 1 mgpaulus mgpaulus 9550 Apr 1 23:04 >setiathome_3.03-2_i386.d >eb >drwxr-sr-x 2 mgpaulus mgpaulus 4096 Mar 14 20:00 test > >mpaulus AT csu6223286:~ >$ cat doit >#!/usr/bin/expect -f >spawn /usr/bin/ssh -l userid host "ls -l" >expect -re "word:" >send "password\r" >expect eof > >mpaulus AT csu6223286:~ >$On Wed, 30 May 2001 14:22:29 -0400, Simha, Shuba wrote: > >>Hi Cygwin users, >> >>I am using Expect-5.26 from Cygwin-1.3.1 >>I am trying to connect to a remote host through SSH, & on the command line, >>it works just perfect. But when I write an "Expect" script for the same, it >>does not do anything. >> >>Here is the comand I use: >> /bin/ssh -l username -p port hostname.abc.com "ls -l" >>It prompts for the passphrase, & when I enter it, it neatly lists the >>contents of my home dir. (username, port & hostname.abc.com actually have >>real values) >> >>The Expect code fragment is below: >> >>#!/usr/bin/expect >>spawn /bin/ssh -l username -p port hostname.abc.com "ls -l" >>expect -re "Enter passphrase for RSA key '.*': " >>send "passphrase\r" >>expect eof >> >>This however does not list anything, though it takes the passphrase.. (I >can >>see the passphrase being echoed on the screen) >>More surprisingly, as soon as the script ends, the monitor will go out of >>echo mode(I cannot see what I type!!) >> >>The same happens when I try SCP as well. >> >>Can anybody tell me whats wrong with what I am doing? >> >>Thanks a lot on advance.. >>-Shuba >> >> >>-- >>Want to unsubscribe from this list? >>Check out: http://cygwin.com/ml/#unsubscribe-simple > > > > >-- >Want to unsubscribe from this list? >Check out: http://cygwin.com/ml/#unsubscribe-simple -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple