public_html permission error for htaccess - security

i'm seeing following error continuously in the cPanels error log:
[core:crit] [pid 36081] (13)Permission denied: [client 66.240.192.138:59520] AH00529: /home/<user>/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/<user>/public_html/' is executable
the permission for public_html is currently set as 750. now the problem seems same as the following question:
Permission denied: /var/www/abc/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable?
it is suggested that the public_html should be 755 to fix the issue, but upon googling I found that 755 might be a bad idea and it should be 750. so what to do?

Related

Cannot access website after changing ownership recusively

In my web server, I intentionally changed ownership of the public_html folder recursively using chown user:user -R public_html command. Now i cant access my website. It throws an 403 forbidden error while accessing.
I know the issue is with .htaccess file and I tried changing ownership to root user back again and changing file permission to 755 and 644 back and forth. Still no progress. Please can someone look into this. What is the cause for this and what will be the solution?

Apache 403 error from accessing certain index.php or index.html despite having similar permissions for each

My apache server was once working, but randomly it started spitting out a 403 error for just about every directory. Two directories remain working, how can I get all directories within /srv/www/htdocs working correctly?
I have looked at the permissions for the two directories that work and compared them to other files/folders that aren't being accessed. The two working directories are "BIBETIS" and "nextcloud", while everything else does not work.
The index.php file under BIBETIS is owned by user root, and group www, its permissions are -rwxrwxr-x (I believe 755?). This directory loads fine and functions as expected.
The index.php and index.html file under nextcloud is owned by user wwwrun and group www. Its permissions are -rwxrwxr-x once again. This all functions as expected.
So, based off this I have tried doing sudo chown -R wwwrun:www /srv/www/htdocs, sudo chown -R wwwrun:www /srv/www/htdocs/*, chmod -R 755 /srv/www/htdocs/ and similar variations. This did not fix the 403 error in apache.
I decided to take a step back and focus on a single, more simple directory: "map". This folder has one index.html file. I once again tried changing the permissions as described above, yet nothing seems to help.
The error log for apache reads:
[Fri May 10 01:39:35.665344 2019] [autoindex:error] [pid 2943] [client -:50203] AH01276: Cannot serve directory /srv/www/htdocs/map/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive
[Fri May 10 01:39:36.744342 2019] [autoindex:error] [pid 2943] [client -:50203] AH01276: Cannot serve directory /srv/www/htdocs/map/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive
[Fri May 10 01:39:42.323373 2019] [autoindex:error] [pid 2944] [client -:50204] AH01276: Cannot serve directory /srv/www/htdocs/map/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive
[Fri May 10 01:42:10.018496 2019] [autoindex:error] [pid 2038] [client -:50879] AH01276: Cannot serve directory /srv/www/htdocs/: No matching DirectoryIndex (index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive
Which led me to believe it is only searching for index.php files? So I set up an index.php under the map directory, applied correct permissions, and it worked. If so, why can it not access the main index.php located within the htdocs directory even after setting proper user:group and 755 permissions?
Can you show us the configuration of your vhost and your apache.conf/httpd.conf ?
To be able to read the index.html you need to add to the directive DirectoryIndex index.html otherwise your web server won't know that he needs to read it, it should look something like this:
DirectoryIndex index.html index.php4 index.php5 index.php
As the error message shows clearly, it's not related to file/folder permissions!

Showing error on live server i.e Forbidden

My website is running fine on localhost but on live server it is showing an error i.e.
Forbidden
You don't have permission to access /package-booking.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
This error is showing after following 3-4 next pages from index.php page. I have also changes the public_html's all directory permission to 0755 and files to 0644 but still facing the same problem. Please help me out, I am poorly stuck in it. Thanks in advance.

getting 403(Access Forbidden) error while accessing the site through browser

Hi I'm getting 403 error while im accessing my live site through the browser. It was working fine last day. I'm not sure why this error is coming. I have searched a lot about it. These are the solutions I have tried:
I have changed my httpd.conf file's configurations from default to :
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes
AllowOverride All
Order deny,allow
Allow from all
</Directory>
Changed the permission for /var/www/html directory from default to 777
and few more things. But nothing worked. I am not sure what is going wrong.
My server configurations are:
Apache/2.2.29.
AWS EC2 Instance.
This is the Error message shown on browser:
forbidden
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
This is the Error message from error_logs:
[Thu May 21 14:58:51 2015] [error] [client XXX.XXX.XXX.XXX] Directory index forbidden by Options directive: /var/www/
[Thu May 21 14:58:51 2015] [error] [client XXX.XXX.XXX.XXX] File does not exist: /var/www/error/noindex.html
please let me know in comments if you need anything else. Thanks in advance :)
I was trying to set up vhost for Apache/2.2.29. AWS EC2 Instance.
meet same error .
I solve it by looking the error.log
I need to give 755 to the parent folder
in your error log " File does not exist: /var/www/error/noindex.html"
means you need to have this folder and the file.
what I use is chmod 755 -R /var/www/
You can try following steps:
In httpd.conf file Options -Indexes +FollowSymLinks +MultiViews +Includes
Run on terminal: chown -R apache:apache /var/www/html
Restart Apache
SE Linux sets security context label to every file. If there is an error setting the security context label the system throws forbidden error.
Using "restorecon -v R" along with path name of the file's directory can clear the forbidden error.
The "restorecon" command restores the default security context to the file.

Permission denied: .htaccess pcfg_openfile

I'm a programmer with very little knowledge of website administration. I've inherited the task of uploading our new pages and data to our website. I have a sandbox site that works great, and I've transferred everything for that site to the live site. Now I get 403 in the browser, and the only clue I've been able to find so far is in one of the error logs: Permission denied: .htaccess pcfg_openfile. But both the old and new .htaccess files have 0644 permissions, and both parent directories have 0750 permissions. I don't know where to go from here. Help!
Change the parent from 750 to 755.
Update. Then try this from a shell prompt.
chmod -R 755 /path/to/siteroot/

Resources