Need help: cron jobs can't access network drives.

Andrew DeFaria ADeFaria@Salira.com
Tue Sep 9 19:43:00 GMT 2003


Louis-Luc Le Guerrier wrote:

> The target (sharing) machine has Windows XP, and I have not yet found 
> how to change the share permission to "everyone". I remember that in 
> previous Windows versions, but Microsoft seems to have moved options 
> all around, and just this straight forward task seems complicated now.

Let's say you are sharing C:\Cygwin\tmp on the XP box. Open up an 
Explorer and go to C:\Cygwin. Right click on tmp and select Properties. 
Select the Sharing tab then click on the Permissions button. You should 
see Everyone there with Full Control set to allow. If not then change it.

> I have been able to log in on the target machine as Administrator, 
> with the same password, and made the share again. 

Once you login with a password the password is available to authenticate 
your access to the share.

> On the server (source machine) I also tried to create a SYSTEM account 
> since none is in the user account list, 

Which user account list?

> but it refuses to create it saying one already exists. In any of these 
> cases, nothing works, and I'm still unable to access the network drive 
> with 'cron'.
>
> On UNIX (cygwin) side, how can I tell 'cron' to execute with a 
> different user than "Administrator"? 

Cron runs as the user SYSTEM. crontabs (created by crontab) are made on 
a per user basis. When cron (the service running as SYSTEM)  needs to 
execute a cronjob of a user it will switch user to that user. So user 
joe can create a crontab and when cron runs it it will switch user to 
joe. User Administrator can also create a crontab and when cron runs it 
ti will switch user to Administrator.

This switch user is a "passwordless" login. As such no password is 
available to authenticate the user to network shares (like network drive 
mapping). Thus such attempted access fails.

However, you should be able to access things via a UNC path if that 
share has everyone set to full control. So try

0 * * * ls //<server>/<share> > /tmp/debug.log

You may want to change the 0 and the * to a more appropriate and 
immediate time. Also change <server> and <share> their appropriate 
names. Then check /tmp/debug.log. What did it list?

> Maybe this will work. How do I provide the password, then?

You don't. See above.

> Our server has become a "Domain Server", so it might be the problem. 
> I'm not that familiar with domain accounts.

Have your /etc/passwd and /etc/group files been generated with mkpasswd 
-d for domains? Or are you using local accounts? If you are, say, using 
the local Administrator account and trying to access a share on the 
domain then beware that local Administrator != the domain's 
Administrator account. Why don't you stick to your domain username for now.

> How can I determine what user 'cron' runs under? If I schedule an 'id' 
> command through cron, 'id' shows user is Administrator, but does it 
> mean it is the user? 

Not sure what "schedule and 'id' command" means. Do you mean that (being 
logged in as Administrator) you did a crontab -e and added a line to 
execut the id command?



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



More information about the Cygwin mailing list