delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/10/21:27:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
From: "Paul J. Ghosh" <p DOT j DOT g AT softhome DOT net>
To: cygwin AT cygwin DOT com
Subject: RE: Cygwin Cron on Windows 2003 Server Issues
Date: Fri, 10 Sep 2004 20:27:05 -0500
Message-ID: <000001c4979e$742fc090$6500a8c0@PJGVAIO>
MIME-Version: 1.0
In-Reply-To: <Pine.GSO.4.61.0409101759220.12144@slinky.cs.nyu.edu>
Note-from-DJ: This may be spam

------=_NextPart_000_0001_01C49774.8B59B890
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Larry/Igor - well - this is the first time I am participating in the
cygwin mailing list and from what I have read at http://ezmlm.org/ it is
supposed to add to threads if the subject is identical.  I have been
using the same subject line.  There was not an initial email that I
could have replied to nor was there a References: that I could have
manipulated when I started.  I read the responses by going to the site
http://cygwin.com/ml/cygwin/2004-09/ which just lists items
chronologically.  But, since it was not available night before last I
discovered the site http://www.mail-archive.com/cygwin AT cygwin DOT com/ that
actually does have all my responses threaded correctly.  In fact, the
presentation is prefered since it is by thread/subject as opposed to by
date/time.  So, tell me what I am supposed to do such that responses are
correctly threaded and I will comply...

Igor - even though we did not state the command executed to add cron as
a service it did include the -D option as described in the message
http://www.mail-archive.com/cygwin AT cygwin DOT com/msg31538.html.  Yes, we
have tried running it as you have described and it still fails with the
error: cron : PID 3784 : starting service `cron' failed: execv: 128,
Transport endpoint is not connected.  Also yes, you have correctly
pointed out that the -a is erroneous in my summation of steps.  I am
including an updated set of instructions just to ensure that any future
readers will not be mislead.

Pierre - your suggestion - will it not lead to root privileges for
svccron?  If yes, then that is not desirable.  However, I will try it
out and let all know the outcome.  In a bash shell with a simple command
it prompts for a password.

$ su -c "exec echo foobar" system
Password:
su: incorrect password

Thank you all once again.  Hopefully one of you can get it to work on
W2K3 without wrappers.


Regards,

Paul J. Ghosh

overview:
	- create local user called 'svccron'
	- set up permissions for local user
	- create wrappers for cron/crontab
	- add wrapped cron as service
	- set up schedules

execute the following within a bash shell:

	- create local user called 'svccron'

  	net user svccron <passwd> /add /yes
  	net localgroup <administrators_group_name> svccron /add
  	editrights -a SeAssignPrimaryTokenPrivilege -u svccron
 	editrights -a SeCreateTokenPrivilege -u svccron
  	editrights -a SeIncreaseQuotaPrivilege -u svccron
  	editrights -a SeServiceLogonRight -u svccron
  	mkpasswd -l -u svccron >> /etc/passwd

	for security reasons:
  	editrights -a SeDenyInteractiveLogonRight -u svccron
  	editrights -a SeDenyNetworkLogonRight -u svccron
  	editrights -a SeDenyRemoteInteractiveLogonRight -u svccron

	- create wrapper for cron - attached 'xcron'/contents below
	- install in /usr/sbin
	- change permissions for xcron
	$ chmod 744 /usr/sbin/xcron

	$ cat /usr/sbin/xcron
	#!/usr/bin/bash
	/usr/sbin/cron -D

	$ ls -l /usr/sbin/xcron
	-rwxr-xr-x    1 devadm   Domain U       34 Sep 10 14:03
/usr/sbin/xcron

	- create wrapper for crontab - attached 'xcrontab'/contents
below
	- install in /usr/bin
	- change permissions for xcrontab
	$ chmod 744 /usr/bin/xcrontab

	$ cat /usr/bin/xcrontab
	#!/usr/bin/bash
	/usr/bin/crontab $@;
	xval=$?;
	chmod 644 /var/cron/tabs/$USER;
	exit $xval;

	$ ls -l /usr/bin/xcrontab
	-rwxr-xr-x    1 devadm   Domain U       90 Sep 10 13:58
/usr/bin/xcrontab

	- add wrapped cron as service
	$ cygrunsrv -I xcron -p /usr/sbin/xcron -u svccron -w <passwd>

	- execute following as user for which tasks need to be scheduled
	$ xcrontab -e

	- for details
	$ man 5 crontab

------=_NextPart_000_0001_01C49774.8B59B890
Content-Type: application/octet-stream;
	name="xcrontab"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="xcrontab"

#!/usr/bin/bash
/usr/bin/crontab $@;
xval=3D$?;
chmod 644 /var/cron/tabs/$USER;
exit $xval;

------=_NextPart_000_0001_01C49774.8B59B890
Content-Type: application/octet-stream;
	name="xcron"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="xcron"

#!/usr/bin/bash
/usr/sbin/cron -D


------=_NextPart_000_0001_01C49774.8B59B890
Content-Type: text/plain; charset=us-ascii

--
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/
------=_NextPart_000_0001_01C49774.8B59B890--

- Raw text -


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