Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 05-17-2006, 11:54 AM   #1
Registered: Apr 2005
Posts: 57

Rep: Reputation: 15
.htaccess + .htpasswd not working

Hi all,
When I go to the web page it prompts me for a username and password which is good. But when I enter the username and password it pops right back up like it did not recognize it.

I checked the /var/log/httpd/error.log and this is what it says:

MySQL ERROR: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

MySQL user vern not found: /

Why is it checking MySQL when I am using .htaccess?

And what else might I check?
I set up the file like this: /var/www/html/.htaccess
Changed the permissions to 644
Created the .htpasswd in /var/www/html and also changed permissions to 644
Was not sure but I changed the group and owner to be the same as what runs apache.

Old 05-17-2006, 09:28 PM   #2
Registered: Jul 2003
Location: NY
Distribution: None (src & compile)
Posts: 296

Rep: Reputation: 49
You seem to be using a MySQL backend for authentication, and placing the configuration for that inside .htaccess files. .htaccess files can hold other data, and other auth types, not just MySQL. By the output message, I'd say the password database is configured to be looked at and checked by a default user "vern", who MySQL does not know about (eg, doesn't exist in its user database) or is using an incorrect password. Check these pages in your Apache manual (these examples are from 2.2.2, they may be different if your version differs):


Unless you have alot of users, it may be alot easier to use auth basic or auth digest, and put those configs inside the main one and do away with .htaccess altogether. The manual recommends them only if you don't have access to the main server configuration file (as in a hosting environment, for example).


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
.htaccess .htpasswd plisken Linux - General 5 05-21-2006 01:44 PM
.htaccess .htpasswd issue Robin01 Linux - Newbie 4 12-24-2003 03:36 PM
.htaccess / .htpasswd inq Robin01 Linux - Newbie 1 12-20-2003 05:36 PM
Help with .htpasswd and .htaccess MikeeX Linux - General 3 03-25-2003 10:41 AM
Cannot see .htaccess and .htpasswd files John_Saunders Linux - Newbie 2 07-21-2002 09:14 AM

All times are GMT -5. The time now is 02:35 PM.

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