Solved

I am recieving this error (Warning: chdir(): Permission denied (errno 13)) when I run a php file as a cron job in CentOS

Posted on 2008-10-24
3
967 Views
Last Modified: 2013-12-16
I created a cron job in cPanel (CentOS) to run a php file every hour.  It was going fine, until one hour it began returning this error.  I set the permissions for that file to 777, but that didn't resolve it.  I also tried taking ownership of public_html with the nobody account, which also didn't work.  What am I missing here?  Do cPanel cron jobs run as a special user?
0
Comment
Question by:ti57
3 Comments
 
LVL 27

Expert Comment

by:caterham_www
ID: 22800597
SELinux may "cause" permission errors, too, but since it worked before... hmmm
0
 

Author Comment

by:ti57
ID: 22800667
How?
0
 
LVL 7

Accepted Solution

by:
macker- earned 500 total points
ID: 22837245
selinux is a kernel level mechanism that allows you to set a policy for a piece of software, like Apache, and dictate what files it can/cannot touch.

Since this is a php script running from cron, it's unlikely it's an SELinux policy.

If the file is permission 777, then anyone can write to it, regardless of user.  However, not anyone can delete it, only the owner can.

This sounds like the parent directory, or one of the parent directories, has the wrong permissions on it.  Check the hierarchy, probably something up north was modified to turn off the bit, e.g. the read/execute bit is no longer set.

The nobody account has no special meaning, unlike root; only the "root" and "nobody" user can write to a file owned by "nobody", unless group/world permissions allow it.  Check that the home directory, which the public_html directory is contained within, isn't 750 ("drwxr-x---") or similar; it must at least "dr-xr-xr-x" all the way up, unless there's a group that matches, with correct group permissions.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now