LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-11-2007, 12:11 AM   #1
shailesh_mishra
Member
 
Registered: Nov 2006
Location: India
Distribution: RHEL 4
Posts: 34

Rep: Reputation: 15
.htaccess with Basic authentication throws MySQL error in Error Log


I am running httpd 2.0.51 (RHEL 4).I am trying to protect certain directory
using .htaccess.Clients are seeing login Box but they are not able to login.As
with basic authentication,i am using passwd.It seems it is not able to excute
SUEXEC. When i see the error log,it gives error that user not found in MySQL.I configured Basic Authentication using .htaccess referrring file passwd which is bring generated by htpasswd.
Any1 out here to help.
 
Old 01-12-2007, 10:51 PM   #2
osdeals
Member
 
Registered: Jul 2006
Distribution: RHEL, CentOS, PuppyLinux, SuSe, Ubuntu, Debian
Posts: 59

Rep: Reputation: 15
Can you paste the related lines from the error_log ?

suexec + .htaccess should not give you problems as such.

Seems that httpd is using mod_auth_mysql to authenticate, instead of simply mod_auth.
You might want to check that in the httpd.conf too.
 
Old 01-16-2007, 01:49 AM   #3
shailesh_mishra
Member
 
Registered: Nov 2006
Location: India
Distribution: RHEL 4
Posts: 34

Original Poster
Rep: Reputation: 15
I also of the same view that it is authenticating from MySQL.But i have not mentioned it anywhere.is there any place in httpd.conf to set authentication type?I mentioned Basic Authentication in my .htaccess.
As asked by you,i am pasting my error log entries

[Wed Jan 10 12:38:41 2007] [error] [client 172.20.100.64] MySQL ERROR: Access denied for user 'apache'@'localhost' (using password: NO), referer: http://portal.ofb.net/
[Wed Jan 10 12:38:41 2007] [error] [client 172.20.100.64] MySQL user test not found: /kb, referer: http://portal.ofb.net/
[Wed Jan 10 12:58:37 2007] [alert] [client 172.20.100.64] /var/www/html/portal.ofb.net/kb/.htaccess: Invalid command 'AuthUserFile', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://portal.ofb.net/
[Wed Jan 10 12:58:52 2007] [alert] [client 172.20.100.64] /var/www/html/portal.ofb.net/kb/.htaccess: Invalid command 'AuthUserFile', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://portal.ofb.net/
[Wed Jan 10 12:59:27 2007] [error] [client 172.20.100.64] MySQL ERROR: Access denied for user 'apache'@'localhost' (using password: NO), referer: http://portal.ofb.net/
[Wed Jan 10 12:59:27 2007] [error] [client 172.20.100.64] MySQL user test not found: /kb, referer: http://portal.ofb.net/
[Wed Jan 10 12:59:31 2007] [error] [client 172.20.100.64] MySQL ERROR: Access denied for user 'apache'@'localhost' (using
We are working in WAN.So it is not actual addresses.

Thanx for taking interest in my thread.
 
Old 01-16-2007, 08:47 AM   #4
osdeals
Member
 
Registered: Jul 2006
Distribution: RHEL, CentOS, PuppyLinux, SuSe, Ubuntu, Debian
Posts: 59

Rep: Reputation: 15
The following lines in the log clearly show that:

Quote:
Originally Posted by shailesh_mishra
[Wed Jan 10 12:38:41 2007] [error] [client 172.20.100.64] MySQL ERROR: Access denied for user 'apache'@'localhost' (using password: NO), referer: http://portal.ofb.net/
[Wed Jan 10 12:38:41 2007] [error] [client 172.20.100.64] MySQL user test not found: /kb, referer: http://portal.ofb.net/
[Wed Jan 10 12:58:37 2007] [alert] [client 172.20.100.64] /var/www/html/portal.ofb.net/kb/.htaccess: Invalid command 'AuthUserFile', perhaps mis-spelled or defined by a module not included in the server configuration, referer: http://portal.ofb.net/
  1. The .htaccess file directives are not being understood since the apache configuration has not probably either not included mod_auth, or excluded it for the path / virtualhost. ( See the entry at 12:58:37 ).
  2. The application (in /var/www/html/portal.ofb.net) is trying to use mysql and failing due to an improper setup. Did you forget to configure the access to the mysql database the application requires?

You will want to check the 'AllowOverride' directive, and its use for the particular virtualhost / directory.

You will also want to look up the documentation for the 'portal.ofb.net' application / check with the developers for any Mysql database connections it needs.
 
Old 01-16-2007, 11:59 PM   #5
shailesh_mishra
Member
 
Registered: Nov 2006
Location: India
Distribution: RHEL 4
Posts: 34

Original Poster
Rep: Reputation: 15
i will just give a try and get back to you."AllowOverride Authconfig" is written inside <directory /var/www/html> which is root for Web Server.Portal.ofb.net is a virtual host with DocumentRoot </var/www/html/portal.ofb.net>.I have not mentioned any <Directory> inside this virtual host.What i think that above setup(Authconfig in web server root) will suffice.Any way i will check all the hints you gave.

Thanks.
 
Old 01-17-2007, 02:18 AM   #6
shailesh_mishra
Member
 
Registered: Nov 2006
Location: India
Distribution: RHEL 4
Posts: 34

Original Poster
Rep: Reputation: 15
Every1 told its going to be very easy but i dont know y it has created so much trouble in my case.There is a directory "conf.d" in which several configuration files are stored which are loaded at runtime.I commented the line in "auth_mysql.conf" which was loading the MySQL module.The README(inside conf.d)says that these modules will be loaded alphabatically(i am not sure what does that really mean?.NOW,MySQL is not authenticating all the user BY DEFAULT.
I added
<Directory "/var/www/html/portal.ofb.net">
AllowOverride AuthConfig
</Directory>
inside <Virtual host> portal.ofb.net </Virtual host>.
keeping AuthConfig inside Virtual Host is a better and more logical way.

Now its working.Thank you osdeals.U are really very helpful.

Last edited by shailesh_mishra; 01-17-2007 at 02:20 AM.
 
Old 01-17-2007, 11:15 AM   #7
osdeals
Member
 
Registered: Jul 2006
Distribution: RHEL, CentOS, PuppyLinux, SuSe, Ubuntu, Debian
Posts: 59

Rep: Reputation: 15
Glad to be able to help , and you're welcome!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic authentication with .htaccess throws MySQL error in Error Log shailesh_mishra Linux - Networking 2 01-12-2007 02:16 PM
dmesg throws up error mesage Steve50 Slackware 1 10-04-2006 04:04 PM
MySql Error > Can't log in paleogryph Linux - Software 1 01-24-2005 10:15 PM
Every Page of LQ throws a JS error. Rotwang LQ Suggestions & Feedback 5 04-18-2004 01:41 PM
apache .htaccess basic authentication not working quite right kleptophobiac Linux - Software 3 01-10-2004 03:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration