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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitting a sting into elements 6 69
How do I add date to text file name 15 27
Secure registration PHP 7 39
Golang on CentOS / Fedora 2 6
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
This article discusses four methods for overlaying images in a container on a web page
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

739 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