public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Need help: cron jobs can't access network drives.
@ 2003-09-02 14:48 Louis-Luc Le Guerrier
  2003-09-03  4:16 ` David Rothenberger
  0 siblings, 1 reply; 5+ messages in thread
From: Louis-Luc Le Guerrier @ 2003-09-02 14:48 UTC (permalink / raw)
  To: cygwin


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.

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. 

I'm still puzzled, and stuck unable to access network drives.

Anyone can share a clearer procedure of what to do, or an example?

Thanks in advance.

Louis-Luc



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help: cron jobs can't access network drives.
  2003-09-02 14:48 Need help: cron jobs can't access network drives Louis-Luc Le Guerrier
@ 2003-09-03  4:16 ` David Rothenberger
  2003-09-09 18:38   ` Louis-Luc Le Guerrier
  0 siblings, 1 reply; 5+ messages in thread
From: David Rothenberger @ 2003-09-03  4:16 UTC (permalink / raw)
  To: Louis-Luc Le Guerrier; +Cc: cygwin

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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help: cron jobs can't access network drives.
  2003-09-03  4:16 ` David Rothenberger
@ 2003-09-09 18:38   ` Louis-Luc Le Guerrier
  2003-09-09 19:24     ` David Rothenberger
  2003-09-09 19:43     ` Andrew DeFaria
  0 siblings, 2 replies; 5+ messages in thread
From: Louis-Luc Le Guerrier @ 2003-09-09 18:38 UTC (permalink / raw)
  To: David Rothenberger; +Cc: cygwin

On Tue, 2 Sep 2003, David Rothenberger wrote:

> 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 ac
> "Everyone" per the Sharing settings).
>
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.

I have been able to log in on the target machine as Administrator, with
the same password, and made the share again. On the server (source
machine) I also tried to create a SYSTEM account since none is in the
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"? Maybe this will work. How do I provide the
password, then?

Our server has become a "Domain Server", so it might be the problem. I'm
not that familiar with domain accounts.
 
> 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.
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? 

Thanks again for helping.
Louis-Luc
> 
> > 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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help: cron jobs can't access network drives.
  2003-09-09 18:38   ` Louis-Luc Le Guerrier
@ 2003-09-09 19:24     ` David Rothenberger
  2003-09-09 19:43     ` Andrew DeFaria
  1 sibling, 0 replies; 5+ messages in thread
From: David Rothenberger @ 2003-09-09 19:24 UTC (permalink / raw)
  To: Louis-Luc Le Guerrier; +Cc: cygwin

Louis-Luc Le Guerrier wrote:

> On Tue, 2 Sep 2003, David Rothenberger wrote:
> 
> 
>>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 ac
>>"Everyone" per the Sharing settings).
>>
> 
> 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.

I have XP Pro and don't have a problem with this.  Do you have Home or 
Pro?  In Pro, I just bring up Sharing and Security for the folder, go 
into permissions, click the button to add a user, then type "Everyone".

I have disabled simple file sharing on that machine, though.  Perhaps 
that's necessary?  See 
<http://support.microsoft.com/default.aspx?scid=kb;en-us;307874> for 
more info on that.

It may also be that the folder being shared needs to be in an NTFS 
partition.

> I have been able to log in on the target machine as Administrator, with
> the same password, and made the share again. On the server (source
> machine) I also tried to create a SYSTEM account since none is in the
> 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"? Maybe this will work. How do I provide the
> password, then?

There may be a way to do it with cygrunsrv, but I normally do it with 
the Windows Services tool.  Just edit the existing service, go to the 
Log On tab, and the rest should be obvious.  You enter the password 
directly on that screen.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help: cron jobs can't access network drives.
  2003-09-09 18:38   ` Louis-Luc Le Guerrier
  2003-09-09 19:24     ` David Rothenberger
@ 2003-09-09 19:43     ` Andrew DeFaria
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew DeFaria @ 2003-09-09 19:43 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-09 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-02 14:48 Need help: cron jobs can't access network drives Louis-Luc Le Guerrier
2003-09-03  4:16 ` David Rothenberger
2003-09-09 18:38   ` Louis-Luc Le Guerrier
2003-09-09 19:24     ` David Rothenberger
2003-09-09 19:43     ` Andrew DeFaria

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).