Portal Home > Knowledgebase > Articles Database > Error 403 even though chmod at 777
Error 403 even though chmod at 777
Posted by lhmx, 10-13-2012, 07:23 PM |
I made a copy of a working php file (lets say index2.php) but when I tried accessing it I get Error 403 Forbidden. Even if I chmod it to 777 the error remains the same. I am a bit confused how this can be. The rest of the files in the directory work fine. Using Apache 2.2.16 on Debian.
|
Posted by anuja9991, 10-13-2012, 07:28 PM |
Did you check apache error logs?
|
Posted by dcdan, 10-13-2012, 08:02 PM |
I would check that the owner/group is the same as well
|
Posted by lhmx, 10-13-2012, 09:01 PM |
Here is what the apache logs say:
client denied by server configuration: /var/www/app/index2.php, referer: http://xxx.com/xyz.php
(last part made up if anyone cant tell)
|
Posted by dcdan, 10-13-2012, 09:22 PM |
Is it in the same directory as the original file?
|
Posted by lhmx, 10-13-2012, 09:24 PM |
No, the first file is in var/www/ and the second in var/www/app/
The first file looks something like this:
|
Posted by NHRoel, 10-13-2012, 09:46 PM |
Check out the ownership of that certain file.
--Roel.
|
Posted by anuja9991, 10-13-2012, 10:05 PM |
Go to the directory where this file is located and execute.
ls -al
|
Posted by lhmx, 10-13-2012, 10:21 PM |
Ok and what of it? There is an .htaccess file, is that what you're looking for?
|
Posted by lhmx, 10-13-2012, 10:26 PM |
I set the ownership of both files to the only other user aside from root, still getting the error.
|
Posted by lhmx, 10-14-2012, 10:53 PM |
Any ideas guys?
|
Posted by NHRoel, 10-14-2012, 10:54 PM |
Please post the output of the command below,
ls -lZ
--Roel.
|
Posted by lhmx, 10-15-2012, 09:09 PM |
x being the second user
|
Posted by NHRoel, 10-15-2012, 09:13 PM |
Let X own everything and try again.
--Roel.
|
Posted by lhmx, 10-16-2012, 06:14 PM |
He already is. The first column from ls -lZ is the ownership, the second is the creator.
|
Posted by NHRoel, 10-16-2012, 06:23 PM |
X group and X permission?
--Roel.
|
Posted by Seeking Knowledge, 10-16-2012, 08:18 PM |
All files are working fine except index2.php and maybe configs2. If you see there is only one thing that makes these two files different than others. It's the "creator" : root. So, maybe if you just make these two files like the others they will work fine.
Last edited by Seeking Knowledge; 10-16-2012 at 08:31 PM.
|
Posted by lhmx, 10-17-2012, 12:04 AM |
Ok, I changed the group also to x, so now everything has the owner and group set to x. Unfortunately though the error is still there, nothing changed...
To clarify on the error, if I access the file directly without the referrer I still get Error 403. In the error logs it states:
client denied by server configuration: /var/www/app/index2.php
Last edited by lhmx; 10-17-2012 at 12:17 AM.
|
Posted by cygnusd, 10-17-2012, 02:08 PM |
Did you install mod_php?
Have you checked the SELinux config if it affects Apache (causing the 403)?
In case of /var/www/app/index2.php, make sure /var/www/app directory is mode 755
|
Posted by lhmx, 10-17-2012, 06:17 PM |
You have to understand, this is a fully functional directory, all the files in it are functional with the exception of that one file (index2.php) and the app that is being run is used by hundreds of people daily. All I did was make a copy of a working file because I needed an alternative version of it with a single variable changed. So yes, mod_php and all the other ordinary stuff is installed and works properly.
Last edited by lhmx; 10-17-2012 at 06:21 PM.
|
Posted by FINESEC, 10-17-2012, 06:55 PM |
Check apache configuration: .htaccess file and /etc/apache2/apache2.conf.
Make sure that this php script doesn't return 403 error when called directly (look for header() function: grep -i header index2.php).
|
Add to Favourites Print this Article
Also Read
reseller (Views: 786)