Wednesday, September 24, 2014

linux - Mounted HDD not having enough permissions from Apache/PHP



Piwigo gallery, on apache and php, CentOS 6.



The root system is a RAID 128GB. /var/www/html is on the root file system.



Mounted the 320GB hdd to /var/www/html/320 using defaults, it's an ext4 fs.




Put a symlink to it in /var/www/html/galleries which is read by the gallery script so I can upload images to there, then click sync. It gives me the error:



[./galleries/] PWG-ERROR-NO-FS (File/directory read error) PWG-ERROR-NO-FS: The file or directory cannot be accessed (either it does not exist or the access is denied)



chmod 777 set on /dev/sdb1, /var/www/html, and /var/www/html/320 as well as the symlink galleries too. All recursive.



chown apache:apache to everything too.



PHP just can't read/write to it. I tried with and without the symlink, I've tried everything I can think of. Nothing.




Any ideas how I can give apache/php permission to read/write to this drive? With 777 permissions all around it should already be able to.


Answer



CentOS has a special kind of security on his kernel (SELinux), you should try disabling it first.



Check if it's enabled with this command:



#sestatus



It should show enabled



Disable it editing this file:



nano /etc/selinux/config


and change this:





SELINUX=enabled




to:




SELINUX=disabled




And try again...




Good luck...


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...