X-Recipient: archive-cygwin@delorie.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:from:date:to:subject:message-id:references
	:mime-version:content-type:in-reply-to; q=dns; s=default; b=fyg2
	0Ns5IJjf+SeZKYzxDbYVUAVzfMX8REAo4Q9DIAtRLsUUWvb0a5OjErdVFiWxKCwM
	cccl+qfA3XNVj9QmV9UKlysyJGp+itapMHNLaJnfUlbRd2uebkmqdK/SMyKYZ8us
	LpQR5JeSd3aR/xcvA7HASSXwWB3OjcaCpwjkv7I=
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:from:date:to:subject:message-id:references
	:mime-version:content-type:in-reply-to; s=default; bh=OvyoCf5MoW
	UoGT4aYbanDVWqrr4=; b=FU3IRed/VtSjVuSXWMWrKnJ1Ho1GA+WYSgVgc2KFIV
	Ju6WfmLzBRQJb3oiT1Dm2tFUYoTBJ5X7pqfzuonuo47HlHWQyxXl+leeiycjEvVJ
	cGdeuzoTUuWh3NFR2d1c4dLydLAGIIOzUAUXJfXXSn5+WSFW2JMgpDdc99HErMwf
	s=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Spam-Relays-External:sk:mail-pg, familiar
X-HELO: mail-pg1-f177.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=berkeley-edu.20150623.gappssmtp.com; s=20150623;        h=from:date:to:subject:message-id:references:mime-version         :content-disposition:in-reply-to:user-agent;        bh=Q+ryTtrjQENOrWiJRMastYg0k7NR0tXKucp4uZMBW4w=;        b=VUQvkwuBIpv3OPf6cXK0A41+hvwv0LYA3Pd2/WicUyxQ45vee9dG1t+jr+b4bWoVk0         yih3ezvH197JZpcqEPUuDLNQXzV4NBZUFx9Q+/LDMLgIUzx358BDoQHm2ZL6gc7XDYPU         PbTFIfcGPJxk/EAYpF9vuir4QjdOiNRT0/U2uzXbcO4u/tdyidiqcusXoZaS2vLoK0Oh         EsMAEbmnETqIHB8ugE3FhgJ1a6t/uBd2+vbcBxfon3em1xmdhVCpWyZnlApqg7WtouSn         FDlpNSn9TuLFUg0Z5kMjgjEQBb4/gSmi+6se0BghlzISXvU/rduTuzGoQzD19/biPwB5         +UqA==
From: Stephen Paul Carrier <carrier@berkeley.edu>
Date: Wed, 6 Mar 2019 15:44:36 -0800
To: cygwin@cygwin.com
Subject: Re: sshd problem on WS2008R2 64bit
Message-ID: <20190306234436.GA3085@zebra>
References: <20190306124816.GR3785@calimero.vinschen.de> <20190306141716.GS3785@calimero.vinschen.de> <20190306143424.GU3785@calimero.vinschen.de> <CANV9t=SHLCT_xN_T35qTgJmoEBu98gGPaKjHMt559MZ+AwyToQ@mail.gmail.com> <20190306153404.GX3785@calimero.vinschen.de> <CANV9t=QiOH4cB47XzKZsReH7RLdaB0CxgY-o3jYgZ46DbV3OdA@mail.gmail.com> <20190306201331.GB3785@calimero.vinschen.de> <CANV9t=RtsR8+KZ68QirxfiU9w_sGk9QnQejEyJVeBcrdiuOq0w@mail.gmail.com> <20190306205931.GC3785@calimero.vinschen.de> <CANV9t=SEj2CpNNp-OzoKQ0nJ-qPN-9_7_8ELBpCCBGDH0FUOzw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CANV9t=SEj2CpNNp-OzoKQ0nJ-qPN-9_7_8ELBpCCBGDH0FUOzw@mail.gmail.com>
User-Agent: Mutt/1.9.1 (2017-09-22)
X-IsSubscribed: yes

On Wed, Mar 06, 2019 at 02:24:59PM -0700, Bill Stewart wrote:
...   
> For my part, I'm writing a PowerShell script that does the following:
> 
> 1) Create a local user account
> 2) Grant it SeBatchLogonRight
> 3) Create a scheduled task for it

Powershell is probably more elegant if you're familiar with it, but I
found this bash sequence that does the trick:

-----
PW=`dd if=/dev/random bs=15 count=1 | base 64`
net user s4udummy /add
net user s4udummy $PW
wmic USERACCOUNT WHERE NAME=\'s4udummy\' SET PasswordExpires=FALSE

/usr/bin/editrights -u s4udummy -a SeBatchLogonRight
schtasks /create /tn wake-s4u /sc ONSTART /ru s4udummy /rp $PW \
         /tr '"$SYSTEMROOT"\\System32\\cmd.exe /c exit'
sc config cron depend= Schedule
-----

I added the last statement, to make cron dependent on the Task Scheduler,
because my crontabs use '@reboot' and I am worried about cron trying
to spawn an important job before the Task Scheduler has a chance to
fix seteuid().

The dependency isn't logically sufficient as wake-s4u job needs some
time to finish.  But its working so far.  I can configure cron to start
with a delay should Task Scheduler ever lose the race.

Thanks everyone for quick attention to this problem and the workaround!

--Stephen

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

