delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/09/03/00:17:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <3F556B19.8020303@acm.org>
Date: Tue, 02 Sep 2003 21:16:25 -0700
From: David Rothenberger <daveroth AT acm DOT org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Louis-Luc Le Guerrier <leguerri AT IRO DOT UMontreal DOT CA>
CC: cygwin AT cygwin DOT com
Subject: Re: Need help: cron jobs can't access network drives.
References: <Pine DOT LNX DOT 4 DOT 44 DOT 0309021031200 DOT 21103-100000 AT vor DOT iro DOT umontreal DOT ca>
In-Reply-To: <Pine.LNX.4.44.0309021031200.21103-100000@vor.iro.umontreal.ca>

Louis-Luc Le Guerrier wrote:
> Hello,
> I have tried Universal Name Convention path as well, and I still can't
> access the network drives, even with UNC paths inside the script ran by
> 'cron'. The same script invoked  manually accesses net drives of course.
> 
> I have looked at "www.denicomp.com/faq.htm#Q21" and understand partially
> what they mean to do, but they don't explicitly explain how to perform
> the tasks in Windows.

That page explains that to access a network share that requires user 
authentication, Windows needs a password, which isn't available to cron.

For example, cron, running as the SYSTEM user, runs a job for 
Administrator.  It switches to the Administrator user to run the job, 
which tries to access a network share.  This share's permissions require 
the Administrator user to authenticate by providing the correct 
password.  But, cron has no such password, so the access fails.

You should be able to access the network share if the share doesn't 
require you to authenticate to access it (i.e., it allows access by 
"Everyone" per the Sharing settings).

As the page above also explains, accessing through a drive letter won't 
work, so you'll need to use UNC paths, even if this works.

If you only plan to run cron jobs for one user (Administrator in your 
case), you may be able to run the cron service as that user.  You'll 
have to provide the user's password when you setup the service, so 
you'll avoid the problem described above.  However, I don't know whether 
cron will run correctly as any user other than SYSTEM, and I haven't 
tested this, so try it at your own risk.

> I also noticed the 'id' command on the Cygwin shell gives "Administrator"
> as user name when invoked manually. I also included 'id > tstfile' into
> a 'cron' job to send the output of 'id' while in a cron, and it also
> states "Administrator" is the user. I set up a password to the Windows
> Administrator account, and it's the one I log in. cron still fails to
> access network drives even though Administrator has a password and
> I'm trying it with UNC paths. 

When you log in to the machine's console, you provide a password, that 
Windows uses (or tries) for subsequent network share authentication. 
That's why you don't have to type the password in again when you access 
the share from Windows or a bash shell running from the console.  But, 
this password isn't available to a service running on the machine (which 
is good), which is why cron can't access the network share.

> I'm still puzzled, and stuck unable to access network drives.
> 
> Anyone can share a clearer procedure of what to do, or an example?

You can change the share's permissions and use UNC paths or run cron as 
the Administrator user.

HTH,
Dave



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