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
1,047 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

717 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