2

I have a very strange permission problem with my Apache. Let's me explain what happened. We bought AWS EC2 instance and installed there AMI Centos 7 with Webmin image. Our Root path is /home/centos/public_html but unfortunately, we got information on the web 'You don't have permission to access / on this server'. Of course, I change access to the folder and all files, even on 777 and owner 'centos' user. Apache user is part of centos group. When I checked log file I got

[core:error] [pid 3872] (13)Permission denied: [client X.X.X.X:60088] AH00035: 
access to / denied (filesystem path '/home/centos/public_html') 
because search permissions are missing on a component of the path 

On the public_html folder, we have default index.php to show us configuration of PHP and is not working.

<?php
 phpinfo();
?>

Our http.conf looks like that:

User apache Group apache

<VirtualHost *:80>
 DocumentRoot /home/centos/public_html
 ServerName our_domain
 ServerAlias *.our_domain
 <Directory /home/centos/public_html>
  Options Indexes FollowSymLinks
  DirectoryIndex index.php index.html welcome.php
  allow from all
  AllowOverride All
  Require all granted
  AddType application/x-httpd-php .php
 </Directory>
</VirtualHost>

Following this suggestion Apache - Permissions are missing on a component of the path I had run command:

sudo chcon -R --type=httpd_sys_rw_content_t /home/centos/public_html/ 

and nothing, any ideas, thank you in advance for any suggestions.

Aram Grigoryan
  • 740
  • 1
  • 6
  • 24
cyprian
  • 497
  • 1
  • 6
  • 21
  • Is centos directory is accessible for the centos group? – toor Sep 16 '18 at 18:03
  • hmm to check this I created another user testme and I added him to the centos group. When I want to go inside /home/centos/ I've got -bash: cd: /home/centos/: Permission denied. Even though I have there 664 and centos as a owner. User testme is part of group testme and centos. Why is like that? What I'm missing? – cyprian Sep 16 '18 at 19:45
  • Centos is really crazy about security. It's a most safe OS I know. I suggest to transfer your project into /var/www (or similar - I'm using Debian) and after that if you have a free time - to find a solution. – toor Sep 16 '18 at 20:03
  • Also please add a linux and centos tags - maybe experienced admins will help you. I'm not a linux geek. – toor Sep 16 '18 at 20:18
  • I don't know if this solves your problem but in my case there was no write permission for the owner (root) on the / (root) directory. – tzp Oct 26 '21 at 17:17
  • I am also having the exact same problem. Can anyone solve this? – Hasanuzzaman Sattar Jun 14 '22 at 09:14

0 Answers0