Friday, June 3, 2016

ubuntu - Cannot write file with apache despite 777 permissions on Directory




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:




Options Indexes FollowSymLinks Multiviews
AllowOverride None
Order allow,deny
Allow from all



Answer




  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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...