delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/14/04:49:25

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Tue, 14 Oct 2003 10:49:14 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Problems with cygwin, "expect" and ssh
Message-ID: <20031014084914.GS14344@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <0A06595FB065D411BC6800508BE32AE417935EF1 AT USPLM212 DOT txpln DOT us DOT eds DOT com>
Mime-Version: 1.0
In-Reply-To: <0A06595FB065D411BC6800508BE32AE417935EF1@USPLM212.txpln.us.eds.com>
User-Agent: Mutt/1.4.1i

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 AT 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 AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019