Tuesday, September 20, 2016

linux - Apache permission to write on user home folder



I'm performing server backup with php script and trying to save the output to home folder.
* I have there available space



Apache is the user that running the php script and don't have permission to write to my user home folder, event when i set chmod 777 to ~/backup.

I try to add symlink to this path but still there is permission issue.



Is there simple way to let Apache drop file to my home folder and still stay secured?


Answer



First of all make sure that the apache user has suitable (rx) access to the ~/backup directory from / down and rwx on the ~/backup directory.



It is also likely that SELinux is playing it's part and denying httpd access to user home directories.



Check the output of




getsebool httpd_enable_homedirs
httpd_enable_homedirs --> off


If it is off as shown above then it needs to be allowed



setsebool -P httpd_enable_homedirs on


If this doesn't solve the problem then take a look in your audit.log and other log files for relevant messages.



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