Search This Blog

Friday, December 18, 2009

Apache, permission denied to open password file

You set the path of your password file correctly, and permission correctly, but when you still cannot access your password file. The Apache log throws you the error:

Permission denied: Could not open password file:

If you have SELinux running, this could very well mean that SELinux denied the permission for your Apache to read the password file. You must run the following to tell SELinux that your added files can be trusted:

chcon -R -h -t httpd_sys_content_t /var/www/PasswordDir

And then your Apache can read everything under /var/www/PasswordDir.


Note that chcon -R -h -t httpd_sys_content_t /var/www/PasswordDir
httpd_sys_content_t is one of the file types that SELinux recognizes, you can change the file type accordingly when SELinux audits your new files.

No comments: