Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using centos 5.7 with cPanel WHM running fastcgi/suEXEC

I am trying to make a particular folder writable to allow a script to upload files but seem to be having problems.

The folder (and all recursive folders) I want to be writable is:

/home/mydomain/public_html/uploads

And I want only scripts run by the user "songbanc" to be able to write to this directory.

I have tried the following:

chown -R songbanc /home/mydomain/public_html/uploads
chmod -R 755 /home/mydomain/public_html/uploads

But it still doesn't seem to work.

The script will only upload files if I set the permissions manually via FTP client to 777.

I assume I am misunderstanding how to set permission for users with fastcgi and hopefully someone can help me.

Thanks in advance

EDIT: Running getfacl on one of the scripts or folders gives the following:

# file: home/mydomain/public_html/ripples/1.jpg
# owner: songbanc
# group: songbanc

So it appears that the owner is correct? I'm now totally confused!

EDIT 2:

The plot thickens... lsattr and chattr are returning Inappropriate ioctl for device While reading flags on...

share|improve this question
    
When you did get successful uploads with permission 777, what was the ownership and group of those uploaded files? –  Skaperen Sep 28 '12 at 13:43
    
I'm afraid I cannot remember. I have tried chowning to user songbanc:songbanc as suggested elsewhere but it returns operation not permitted –  user6595 Sep 28 '12 at 13:50
add comment

1 Answer

up vote 1 down vote accepted

First off, suEXEC is an Apache 1.x module. For various reasons and support issues, upgrading to Apache 2.x with suPHP is the correct path to go. See my previous post here on how to upgrade.

What could be happening is number of things which I will briefly touch on, however upgrading to suPHP would most likely solve this issue. It is important to note that changing PHP 5 Handler to be suPHP is the important part here.

Causes:

  1. You are not running suEXEC and in fact the scripts are not being executed under the username. You can perform top -u username -d 1 where username is the username of the account. You should notice php files show up on that screen every time they are ran.

  2. The parent folder does not have correct permission. If you are running an older version of Apache, and I suspect this is the case since you mentioned suEXEC you can get away with this. If you were running suPHP, this would not be an issue as it will catch it. So make sure parent folders have correct permissions.

  3. You are not running PHP. suPHP or suEXEC are only for PHP scripts. If you are running anything else, they may or may not be ran under that user depending on how you have Apache setup. For the most part they should, but who knows!

Take away: Upgrade to Apache 2.x with suPHP and you should be covered. Just make sure you change the PHP handler to suPHP as described the link I posted.

share|improve this answer
    
Thanks Adam, I actually manged to solve this myself some time ago. Regardless, you're answer was correct. :-) –  user6595 Oct 29 '12 at 7:22
    
@user6595 glad I can help :) Always good to post an answer to your old question incase the next person has the same issue you did! Enjoy –  Adam Oct 29 '12 at 18:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.