Calling SSH from Expect - URGENT
Thu Jun 14 09:23:00 GMT 2001
I am still working on this, its sad that very few in the Cygwin world could
help me on this!
Corinna, I saw a similar problem in the cygwin mailing list in the thread -
"ssh/sshd command line missing response".
Can you tell me what my problem is? I desperately need help on this..
From: Simha, Shuba
Sent: Thursday, May 31, 2001 11:37 AM
To: 'Mark Paulus'; firstname.lastname@example.org
Subject: RE: Calling SSH from Expect - URGENT
The very same does not work for me !!! Here's the output from my session..
$ cat connect_ws
spawn /bin/ssh -l username -p 1010 hostname "ls -l"
expect -re "Enter passphrase for RSA key '.*': "
spawn /bin/ssh -l username -p 1010 hostname ls -l
Enter passphrase for RSA key 'admin@WS007594': shuba
<Comments> No output !!
$ callconn.pl connect_ws ftp-rfc shellscript try
cfile.c connect_ws~ perlfile.pl shellscript1
<Comments> I typed ls - not echoed
$ This is not seen
<Comments> I typed echo This is not seen - The command is invisible !!
From: Mark Paulus [ mailto:email@example.com ]
Sent: Thursday, May 31, 2001 10:36 AM
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
spawn /usr/bin/ssh -l mgpaulus 22.214.171.124 ls -l
drwxr-sr-x 2 mgpaulus mgpaulus 4096 Mar 12 23:35 News
drwxr-sr-x 2 mgpaulus mgpaulus 4096 Mar 8 23:13 bin
drwxr-sr-x 8 mgpaulus mgpaulus 4096 Mar 30 13:17 fetchmail-5.3.3
$ cat doit
spawn /usr/bin/ssh -l userid host "ls -l"
expect -re "word:"
On Wed, 30 May 2001 14:22:29 -0400, Simha, Shuba wrote:
>Hi Cygwin users,
>I am using Expect-5.26 from Cygwin-(not sure of the version)
>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
>The Expect code fragment is below:
>spawn /bin/ssh -l username -p port hostname.abc.com "ls -l"
>expect -re "Enter passphrase for RSA key '.*': "
>This however does not list anything, though it takes the passphrase.. (I
>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..
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin