I have a site that needs to be protected with .htaccess
file.
But I get permission denied error while accessing my site ignoring the correct login. Apache Server version: Apache/2.2.3
.htaccess
file :
[root@server conf]# cat /home/molly/www/.htaccess
AuthName "Directory Auth for User Molly"
AuthType Basic
AuthUserFile /home/molly/.htpasswd
require user molly
Permissions :
[root@server conf]# ls -al /home/molly/www/.htaccess
-rwxr-xr-x 1 molly apache 116 Jan 13 18:12 /home/molly/www/.htaccess
[root@server conf]#
Earlier the permissions were 644 to htaccess
file, but I changed it to 755 after checking some solutions, but of no use
Similarly, permissions on .htpasswd
file :
[root@server conf]# ls -al /home/molly/.htpasswd
-rwxr-xr-x 1 molly apache 46 Jan 13 18:58 /home/molly/.htpasswd
[root@server conf]#
Error log file :
[Wed Jan 14 11:59:29 2015] [error] [client 10.0.0.7] (13)Permission denied: Could not open password file: /home/molly/.htpasswd
[Wed Jan 14 11:59:29 2015] [error] [client 10.0.0.7] access to /~molly failed, reason: verification of user id 'molly' not configured
Also I changed the user directory permission to 755 as such, but of no use.
[root@server conf]# ls -ld /home/molly/
drwxr-xr-x 4 molly molly 4096 Jan 13 18:23 /home/molly/
[root@server conf]#
I am unable to move forward because of this weird htpasswd problem.
Any Ideas
I hope many guys might have gone through this problem.
/home/molly
. Tryls -ld /home /home/molly
and ensure that your Apache user (or group) has got at leastx
access into both these directories. The.htaccess
file itself does not needx
permission so you can reset that back to0644
. – roaima Jun 14 '16 at 21:07