delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/05/02/11:58:38

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:reply-to:mime-version:to
:subject:references:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=g/deoJTBQK4f+MU4
bbzLL6p1QtXotMJqOOd8lcqNEdPAXCZGvbuwUnd2HZR2RgIHXJhmurAcMYWPFlb9
VI6NThhotV1R/Uu55TVZ5onBdVCUwvJol5kkVwWTLTLMOYhm3Syj8MIu+mKW9h50
vS2Im4s4WS4A8AFl/PYHUQLvRy4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:reply-to:mime-version:to
:subject:references:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=1wgcavXpQYxZ8FbGEW63JM
rcjE0=; b=xreGVNb9b+9AwMz/2z7Sn3vcjROzJzwLKpXeDq/lztbQNipUOoeq+a
vZFFu69LtPdVhK8O1Dgroby0Re8CtrxjPsJT/8r9T9LEUbil3xH95jNrfAOPyGGV
aeH2Gq9RlJNiSZ1EIa4uZjQQgAJtSL88NVY5mr70ldY7wGi71sADw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
X-Spam-SWARE-Status: No, score=2.1 required=5.0 tests=AWL,BAYES_00,BOTNET,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RCVD_IN_HOSTKARMA_YE,TW_YG autolearn=no version=3.3.1
Message-id: <51828D00.7030303@cygwin.com>
Date: Thu, 02 May 2013 11:57:52 -0400
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-to: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
MIME-version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Sshd cannot be manually restarted
References: <C91D1A45D873B145BF9EB5577C334053F4CC6A58EA AT EXCHANGE01 DOT pcci DOT int>
In-reply-to: <C91D1A45D873B145BF9EB5577C334053F4CC6A58EA@EXCHANGE01.pcci.int>

On 5/2/2013 10:04 AM, Johnson, Matt wrote:
> I am having difficulty getting the sshd service to run through Cygwin.
> Attached is the cygcheck output for the server that I am having problems with.

OK, let's start with this as a backdrop for this discussion.  sshd is
difficult to configure because of the security restrictions it imposes (by
definition).  While it's possible to configure it to work in all kinds of
situations, it requires allot of knowledge, lots of experimentation, or
both.  To make things easier for the typical usage, ssh-host-config script
exists.  This has its limitations, of course.  In particular, it makes a
special local account to run sshd under with the proper permissions to
support public key authentication for local users (plus general password
authentication).  From the information you've provided below, you've clearly
taken a different route to configure your system.  While you are free to
do so, that puts you in fairly uncharted territory.  So let's proceed with
this as a basis of understanding.

> Attached is a batch file which I initially used to install Cygwin and
> configure sshd (used this script because it worked on 2 other servers).

Oops.  No script attached.  This is both a red flag (use of some unknown
and unsupported script) and a pointer to a possible solution for you.  If
you've used this script successfully on 2 other servers, you have a basis
for comparison between non-working and working servers to find what's
getting in your way here.

> Everything worked fine until trying to start the service. Odd behavior is
> that rebooting the machine results in the service running fine (it is set to
> automatic startup). Stopping the service and trying to start it again
> results in the failures below. I can run /usr/sbin/sshd -D from a Cygwin
> prompt and it works fine.

OK, generally speaking, starting sshd from the command line as your user is
a big 'no-no', assuming you care about public key authentication at least.
You may not care or you may have set your account up with all the necessary
permissions to do this (even domain-wide).  Either one of these courses of
action is fine so long as you understand the limits and/or what needs to be
done to achieve success.  But if what I've just said puts you outside of
your comfort zone, it's best to stop right here and reassess what you're
trying to do.

> Starting from the Services snap-in results in "Windows could not start
> the  CYGWIN sshd service on Local Computer. Error 1067: The process terminated
> unexpectedly." There are no entries in the Application event log related to
> (Cygwin) sshd. Entry in System event log: " The CYGWIN sshd service
> terminated unexpectedly. It has done this 26 time(s)."

You may find more useful information in /var/log/sshd/log.  Based on your
cygcheck output, I would expect that you will find all sorts of log info
there, since you're running a debug session of sshd (good!).  So there will
be all sorts of log info that you can look at and will likely provide some
insight.  Keep in mind, running sshd as debug, while very helpful in for
diagnostics, means that each disconnected session will terminate the sshd
service.

> Admin command prompt:
> ---- Output ----
> C:\>net start sshd
> The CYGWIN sshd service is starting.
> The CYGWIN sshd service could not be started.
>
> A system error has occurred.
>
> System error 1067 has occurred.
>
> The process terminated unexpectedly.
>
> C:\>C:\cygwin\Cygwin.bat
>
> sdoracle AT STREAMINGDEV ~
> $ cygrunsrv -S sshd
> cygrunsrv: Error starting a service: QueryServiceStatus:  Win32 error 1062:
> The service has not been started.
>
>
> sdoracle AT STREAMINGDEV ~
> $
> ---- End Output ----
>
> Things I have tried:
> Used a local privileged user to run the service
> Used a different domain user that successfully runs the sshd service on a different machine
> Created a fresh domain account to run the sshd service
> Searched for duplicate cygwin1.dll's - none found
> Applied full control to SYSTEM to C:\cygwin, C:\cygwin\var, and C:\cygwin\var\log

I'd be careful about setting permissions, especially globally.  Unless
you're going to turn off permission checking for sshd, it's going to be
pretty picky about what it expects where.  Setting things globally usually
results in, frankly, wrong permissions in spots where it counts.  Remember
sshd is trying to maintain some amount of security so it's not only looking
for access in certain areas but also lack of access to groups and others.
See ssh-host-config for details here.

> Removed local group policy object and rebooted machine
> Compared Local Security options and User Rights to working servers (identical except for administrator account name)
> Turned Windows firewall on and off

Sounds like your best bet is to review ssh-host-config comparing
permissions it sets for files and directories with those that
you have on the non-working and working servers.  Also, I'd
recommend carefully going through the sshd.log from your debug
session.  Separately or in combination, I think these two
avenues will help you allot.

-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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