This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with cygwin, "expect" and ssh


On Mon, Oct 13, 2003 at 06:47:12PM -0500, Greenup, Greenup wrote:
>    Enter "expect", which ships with a little script for changing your
> password (even on multiple systems en-mass). Nice.  Except... it doesn't
> seem to work with ssh...  Near as I can tell from my googling, a problem of
> openssh reading the tty directly, rather than allocating a tty.  True?
> False?  What about other things?; messing with the CYGWIN variable, adding
> "tty" in there was not helpful, nor was adding "-t" to ssh.  Any other
> ideas?  I don't want to use telnet... "console telnet" is nice, and will get
> the job done, but it's not a secure answer.

I'm not sure what you did wrong but apparently you did.  I just tried
the following crude script:

========= SNIP =========
#!/usr/bin/expect -f
set timeout 10

spawn ssh mycygwinbox
expect {
  "myusername@mycygwinbox's password: " { }
  default {
    send_user "Spawning failed\n"
    exit
  }
}

send "mypassword\n"
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
  }
}
========= SNAP =========

and it worked perfectly fine, from a Windows console window as well as from
a ssh session itself.  The first two regexps are expecting my prompt, btw.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]