LinuxQuestions.org
Review your favorite Linux distribution.
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 08-24-2006, 11:39 PM   #1
nazs
Member
 
Registered: Apr 2005
Posts: 57

Rep: Reputation: 15
Help with .htaccess


Hi all,
I have been trying to set up access to certain users using .htaccess on Fedora core 4. This is what my .htaccess file looks like with chmod to 644, the owner is root, and group is apache.

AuthUserFile /var/www/html/.htpasswd
AuthName "Members only"
AuthType Basic
require valid-user

I am a little confused on what I need to setup in my httpd.conf file. This is how it is listed in my httpd.conf file at the moment:

#
# AccessFileName: The name of the file to look for in each directory
# for access control information. See also the AllowOverride directive.
#
AccessFileName .htaccess

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

#
#

I get the login to pop up when I try to access the area but it does not seem to recognize the password. I set up the .htpasswd like this which is also chmod 644, owner is root, and group is root.

htpasswd -nm username >>.htpasswd

Then I enter in my password.

If anyone can give some advice I would really appreciate it.

Thanks,
Nazs
 
Old 08-25-2006, 02:00 AM   #2
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
fc4 webserver is most likeley apache2
generally in that case you can find info at http://www.apache.org

what you can do with is this page:
http://httpd.apache.org/docs/2.0/howto/auth.html
especially
http://httpd.apache.org/docs/2.0/how...ttingitworking

try doing what is says there - that will get you cracking :-)
 
Old 08-25-2006, 05:52 PM   #3
nazs
Member
 
Registered: Apr 2005
Posts: 57

Original Poster
Rep: Reputation: 15
Thanks Nathanael.
I have read over those docs again and again and still cannot get it to work correctly. I just don't get it. The login area comes up. It just seems like it will not recognize the password. This is driving me crazy. If anyone else has ideas please post them.

Thanks,
Nazs
 
Old 08-27-2006, 05:46 AM   #4
asif2k
Member
 
Registered: Mar 2006
Location: Texas
Distribution: Fedora Project
Posts: 79

Rep: Reputation: 15
I am having this same problem. On mine nothing is happening. I followed the directions from these sites. http://www.javascriptkit.com/howto/htaccess3.shtml and http://www.tools.dynamicdrive.com/password/

I am confused

.htaccess tutorial
http://www.deluxnetwork.com/linux/guides/htaccess.php

thanks

Last edited by asif2k; 08-27-2006 at 06:18 AM.
 
Old 08-27-2006, 06:07 AM   #5
prozac
Member
 
Registered: Oct 2005
Location: Australia
Distribution: slackware 12.1
Posts: 753

Rep: Reputation: 32
Quote:
Originally Posted by nazs
I get the login to pop up when I try to access the area but it does not seem to recognize the password. I set up the .htpasswd like this which is also chmod 644, owner is root, and group is root.
and apache is running as which user?

i suggest you do the following:
Code:
chgrp apache /path/to/.htpasswd
chmod g+r /path/to/.htpasswd
assuming httpd is running as the user apache, if it's running as another user for e.g. nobody, change it correspondingly.

also Add the following line to server configuration file httpd.conf, inside of the <Directory> block for the www.yourhostname.com host:
Code:
AllowOverride AuthConfig
restart httpd and access your website again. if you experience trouble have a look at or Check the server logs in /var/www/httpd/* for clues.
 
Old 08-27-2006, 05:11 PM   #6
asif2k
Member
 
Registered: Mar 2006
Location: Texas
Distribution: Fedora Project
Posts: 79

Rep: Reputation: 15
ok, I have finally got it. Thanks
Quote:
1. edit httpd.conf
find
<Directory "/var/www/html">
change AllowOverride None to AllowOverride AuthConfig
</Directory>
Quote:
2. find
<Directory /home/*/public_html>
change AllowOverride None to AllowOverride AuthConfig
</Directory>
Quote:
3. use the online tool from these websites to create .htaccess and .htpasswd files. and place them in appropriate locations.

http://www.javascriptkit.com/howto/htaccess3.shtml and http://www.tools.dynamicdrive.com/password/
Quote:
restart httpd

Last edited by asif2k; 08-27-2006 at 11:05 PM.
 
Old 08-28-2006, 06:07 PM   #7
nazs
Member
 
Registered: Apr 2005
Posts: 57

Original Poster
Rep: Reputation: 15
Lol I have tried everyone's suggestions. And I want to say thank you to everyone. But it still is not working. Here is what is in my error log in /var/log/httpd/error_log


[error] [client xx.xxx.xxx.xxx] MySQL ERROR: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[Mon Aug 28 15:34:05 2006] [error] [client xx.xxx.xxx.xxx] MySQL user johndoe not found: /


I am sorry if this sounds like a dumb question but I don't have mysql running. Does it have to be running for .htaccess to work?

Thanks,
Nazs
 
Old 08-29-2006, 01:13 AM   #8
prozac
Member
 
Registered: Oct 2005
Location: Australia
Distribution: slackware 12.1
Posts: 753

Rep: Reputation: 32
No, you donot need mysql running to use .htaccess, BTW, What page were you trying to see when you got the error, seems to me like, the webpage you are accessing uses mysql. Why don't u put a simple html file inside the directory you want to configure .htaccess with, this will simplify the troubleshooting.
 
Old 08-29-2006, 01:31 AM   #9
SlackDaemon
Member
 
Registered: Mar 2006
Distribution: RedHat, Slackware, Experimenting with FreeBSD
Posts: 222

Rep: Reputation: 30
It seems your web server is using mod_auth_mysql. You will need to uninstall it or comment it out in you httpd.conf file in order to use .htaccess.

rpm -e mod_auth_mysql
apachectl restart

best of luck!
 
  


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
.htaccess ralide Linux - Software 3 06-18-2005 11:15 AM
.htaccess luca2005 Linux - Software 2 01-01-2005 07:38 PM
.htaccess artistik Linux - Software 1 10-23-2003 03:24 PM
htaccess help skillcoyne Linux - General 4 04-02-2003 03:46 PM
.htaccess pk21 Linux - Software 3 09-23-2002 08:23 AM

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

All times are GMT -5. The time now is 10:18 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