LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-10-2010, 04:42 AM   #1
marvelade
LQ Newbie
 
Registered: Dec 2006
Location: Belgium
Distribution: Mac OS X; Ubuntu 8.04 in a VM
Posts: 29

Rep: Reputation: 16
find : permission denied


Hey all,

I'm using the find command in a PHP script like this to update permissions on all files but not directories:

<?php

// whole bunch of code

exec("find /var/www/vhosts/mydomain.com/httpdocs/path/to/some/directory -type f -exec chmod -R 440 {} \;");

// whole bunch of other code

?>

The PHP script runs daily with a cron tab.


When I run the script in a browser I get no error messages.

When the crontab runs the script I get this error:

find: /var/www/vhosts/mydomain.com/httpdocs/path/to/some/directory: Permission denied


The PHP script is owned by user www-data, which is the user that PHP runs as on this server (at least that's the result I get when I do

exec("whoami"); // outputs: www-data

).

The crontab is owned by root and looks like this:

10 3 * * * php -q /var/www/vhosts/mydomain.com/httpdocs/crontab_collection_dir/do_some_fancy_stuff.cron.php


at 3:10 AM the script is run by root (I write results to a log file using PHP including the result of "whoami" which says "root")



How is it possible that root can't execute a find command on a directory that it doesn't own?

Should I now officially burn my T-shirt saying "Bow before me, for I am root" ?


best regards,
Marvelade
 
Old 07-10-2010, 04:45 AM   #2
marvelade
LQ Newbie
 
Registered: Dec 2006
Location: Belgium
Distribution: Mac OS X; Ubuntu 8.04 in a VM
Posts: 29

Original Poster
Rep: Reputation: 16
P.S.: My guess was to run all crontabs as root to avoid these kinds of problems...
 
  


Reply

Tags
cron, crontab, find, job, permission denied, php, root



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
Permission Denied Ace Blackwell Linux - Newbie 5 04-13-2008 07:08 PM
'permission denied" inspite of right permission flags on network drive anirudhvij Linux - Enterprise 8 05-22-2007 05:57 AM
Permission Denied Deag^ Linux - Newbie 2 10-20-2004 02:14 PM
find : permission denied! katana Linux - General 8 06-05-2001 07:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration