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 did a clean install of Ubuntu 12.04 and then added a php script that was working fine on Ubuntu 10.04. The script writes a new file to a directory. The Directory is owned by www-data:www:data and has permissions set to 777. I have googled and searched SO & SF and tried many different approaches. I have restarted apache, rebooted the server, and I still get the same error:

Forbidden You don't have permission to access /pdfFiles/new_file.pdf on this server.

It is worth noting that pdfFiles is a directory under the webroot for this site. I have created a directory at the root of the system (/pdfFiles/) with the same owner and permissions

the apache error log contains nothing helpful to me:

(13)Permission denied: access to /pdfFiles/new_filepdf denied, referer:http://mysite/create_file.pdf

I am not running SELinux

Directory:

<Directory />
    Options Indexes FollowSymLinks Multiviews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
share|improve this question
    
Can you post the <Directory> section from your Apache config that corresponds to that path? –  jgoldschrafe Aug 27 '12 at 15:08
    
edited the original post to include –  Scott Aug 27 '12 at 15:31
    
Can the php script read from that directory? Can it write into the system (not webroot) /tmp directory? –  Skaperen Aug 27 '12 at 15:35
1  
In a webserver setup context, having a 777 directory inside DocumentRoot is a double security risk: first one is a general pitfall regarding permissions, second one theoretically allow uploading executable code into DocumentRoot and execute it with web server privileges - at this point your server is compromised. –  AnonymousLurker Aug 27 '12 at 15:38
add comment

1 Answer 1

up vote 1 down vote accepted
  1. show output of mount(8) to see what file attributes you have on that filesystem
  2. also try using su to switch to user that apache and use touch $FILE in same directory
  3. I know you said you not running SELinux but try "getenforce" just to make sure.
share|improve this answer
1  
#2 did the trick - well, at least it revealed the problem. the apache user (www-data) could not create a file in the directory, it could not even cd into it. I deleted the directory, recreated it, I am the owner, I changed the group to www-data and perms to 774 and it all just works now. THANKS! –  Scott Aug 27 '12 at 15:46
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.