www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/16/13:38:02

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=AWL,BAYES_00,DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG
X-Spam-Check-By: sourceware.org
Message-ID: <21505830.post@talk.nabble.com>
Date: Fri, 16 Jan 2009 10:37:22 -0800 (PST)
From: blazt <johnny DOT costello AT slipg8 DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: automate SSH-HOST-CONFIG
In-Reply-To: <21490305.post@talk.nabble.com>
MIME-Version: 1.0
References: <21383170 DOT post AT talk DOT nabble DOT com> <21427082 DOT post AT talk DOT nabble DOT com> <ddc185be0901130048l3bea8c66v5b49098454113769 AT mail DOT gmail DOT com> <21442493 DOT post AT talk DOT nabble DOT com> <ddc185be0901151433v4742b1b0x37230aa2e94d896d AT mail DOT gmail DOT com> <21490305 DOT post AT talk DOT nabble DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

Here is the complete script for anyone in the future. There was some odd
stuff that this did until I got it worked out. This is for a brand new
install of cygwin on a box that has never been used before. I am sure 
someone can possibly edit this so that it can select from a different number
of expect statements in case a user has installed cygwin before and is now
doing a reinstall.

#!/bin/expect -f

# required on Win2k3
exec chmod +r /etc/passwd
exec chmod +r /etc/group
exec chmod +x /var

spawn ssh-host-config

# Host keys generation is lengthy procedure
set timeout 20

expect {
  "Should privilege separation be used? (yes/no)" { send "yes\r" }
} 

set timeout 5

expect {
  "Note that creating a new user requires that the current account have" {
send "yes\r";
exp_continue }
  "Do you want to install sshd as a service?" { send "yes\r";
exp_continue }
  "Enter the value of CYGWIN for the daemon:" { send " \r"; }
}

set timeout 5

expect {
 "Do you want to use a different name? (yes/no)" { send "no\r"; 
exp_continue }
 "Create new privileged user account" { send "yes\r"; 
exp_continue }
 "Please enter" { send "pwd\r";
exp_continue }
 "Reenter:" {send "pwd\r";
exp_continue }
}







blazt wrote:
> 
> Thank you Dimitri. It was my bin bash that cuased it to not work. I was
> not aware that I did not have to include that. Once I fixed that and put
> things back. it worked.
> 
> Thank you
> 
> 
> 
> Dmitry Semyonov-2 wrote:
>> 
>> On Tue, Jan 13, 2009 at 22:16, blazt wrote:
>> 
>>> I created the script based on yours but it never sends the expect back
>>> to
>>> the program.
>>>
>>> #!/bin/bash
>> 
>> This line was not included into my sample. I doubt it can work this way.
>> 
>>> #!./expect -f
>> 
>> Why the dot-slash? Do you have expect executable in your local
>> directory? Have you compiled it by yourself?
>> 'expect' package could be installed through Cygwin setup. You should
>> use this method instead.
>> 
>>  [...]
>> 
>>> I took out the exec so I could see the script run and it simply hangs at
>>> the
>>> first query where it asks to overwrite existing files. Is there anything
>>> else I need to do to get this to work with cygwin?
>> 
>> If you don't have enough experience don't make unnecessary changes or
>> add your bits before ensuring that the provided sample works. Read the
>> man. Experiment with simple things.
>> 
>> -- 
>> ...Bye..Dmitry.
>> 
>> --
>> 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/
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/automate-SSH-HOST-CONFIG-tp21383170p21505830.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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