delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/03/11:50:57

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
Message-ID: <42274010.8040800@vss.fsi.com>
Date: Thu, 03 Mar 2005 10:49:20 -0600
From: Bryan Thrall <thrall AT vss DOT fsi DOT com>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cron copy on network drives
References: <1109867877 DOT 2260 DOT ezmlm AT cygwin DOT com>
In-Reply-To: <1109867877.2260.ezmlm@cygwin.com>
X-OriginalArrivalTime: 03 Mar 2005 16:50:17.0991 (UTC) FILETIME=[1478A170:01C52011]
X-IsSubscribed: yes

> From: Paul Hodor
> Date: Thu, 3 Mar 2005 08:13:36 -0800 (PST)
> 
> Hi,
> 
> I am trying to set up a cron service to update some directories on a
> network drive, but I ran into a problem.
> 
> This copy command works from the command-line:
> cp -a -u -v //mydrive/myshare/dir1/* //mydrive/myshare/dir2 >> log 2>&1
> 
> However, if I run it with cron I get the following error:
> cp: cannot stat `//mydrive/myshare/dir1/*': No such file or directory
> 
> Do I need to use a different syntax for the path or am I doing
> something else wrong? I am running Windows XP Professional version 2002
> SP1 and cygwin DLL version 1.5.12.
> 
> Thanks,
> Paul
> 

I think I've run into this very problem. Are you running cron as a 
different user than your login (such as SYSTEM)? My understanding is 
that in that case, cron has a limited form of su which does not allow it 
to fully authenticate as you when accessing network drives. So, it tries 
to su to your login when it runs your cron job, but cannot read or write 
to network drives you have mapped.

Unfortunately, I don't know a workaround for this. You could have cron 
map the network drive itself (using 'net use') but that would probably 
require a password - in plain text! You could also run cron as yourself 
so it actually uses your login (rather than trying to su), but that 
means every time you login you have to start cron and it won't be 
running after you log out!

You might be able to get around this by using ssh instead of network 
drives (a combination of a ssh server on the remote machine and 
ssh-agent to avoid plaintext passwords in your cron job script, maybe).

That's how it was explained to me, anyway. HTH!

-- 
Bryan Thrall
Realtime Software Engineer
FlightSafety International

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