From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28617 invoked by alias); 13 Jan 2009 08:48:44 -0000 Received: (qmail 28609 invoked by uid 22791); 13 Jan 2009 08:48:44 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from yw-out-1718.google.com (HELO yw-out-1718.google.com) (74.125.46.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Jan 2009 08:48:04 +0000 Received: by yw-out-1718.google.com with SMTP id 9so3704163ywk.38 for ; Tue, 13 Jan 2009 00:48:02 -0800 (PST) Received: by 10.150.57.5 with SMTP id f5mr12103471yba.61.1231836481897; Tue, 13 Jan 2009 00:48:01 -0800 (PST) Received: by 10.150.144.11 with HTTP; Tue, 13 Jan 2009 00:48:01 -0800 (PST) Message-ID: Date: Tue, 13 Jan 2009 09:45:00 -0000 From: "Dmitry Semyonov" To: cygwin@cygwin.com Subject: Re: automate SSH-HOST-CONFIG In-Reply-To: <21427082.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <21383170.post@talk.nabble.com> <21427082.post@talk.nabble.com> X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2009-01/txt/msg00351.txt.bz2 Hi Johnny, On Tue, Jan 13, 2009 at 03:28, blazt wrote: > > I am not sure how to do a except script. I have been looking at what I can > find on the net. It is 'expect', not 'except'. It's enough to read 'man expect' for basics. You'll have to learn some Tcl docs for advanced usage, (not required for ssh-host-config automation). > Would I pass this command into the except part? See an excerpt from my expect script below. I don't provide the full version, as it is complicated more than necessary for the demonstration due to support of different OSes and corner cases. (Also it was not verified with the latest ssh-host-config.) #!/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 { "Overwrite existing /etc/ssh_config file? (yes/no)" { send "yes\r"; exp_continue } "Overwrite existing /etc/sshd_config file? (yes/no)" { send "yes\r"; exp_continue } "Should privilege separation be used? (yes/no)" { send "yes\r" } } set timeout 5 expect { "Should this script create a local user 'sshd' on this machine? (yes/no)" { send "yes\r" } "new local account 'sshd'? (yes/no)" { send "yes\r" } } # [skipped] expect eof { exec cygrunsrv -S sshd } -- ...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/