Page 1 of 1

PostPosted: Sat Oct 04, 2008 8:08 pm
by Alanex
Hi all,
Having annoying problems with .htaccess and .htpasswd

The biggest problem is I don't know how to use them!

I've worked through a few tutorials via google, explaining how to use the files and none of it has worked. They all related to using them with Apache (yes, I have it installed and working!)

Here's what I have:

FREESCO 0.3.8
Apache 1.3.27
I have a new directory at /www/secure
which contains a few files including "index.htm" & "test.htm".

All the files work as expected, ie. images, etc

I have placed my .htpasswd & .htaccess in several places (according to various tutorials) and have yet to see any "Password" boxes appear!

I have had no errors and htpasswd did create files and the file did contain username and encrypted passwords. I just don't know what else I need to do and none of the tutorials mentioned anything else other than creating the files and occasionally using chmod on the files.
The most common .htaccess file was:

Code: Select all
AuthUserFile /www/secure/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted Area"
AuthType Basic
 
require valid-user


Is there a tutorial that works for Apache on FREESCO? Or is there something all these tutorials is missing?

This is my biggest problem with *nix in general, not all tutorials work with all distros. Tho my biggest hate is when someone says use "this" command and all I get is "this is not a recognised file or command" THEN you find out that you have to mess around with paths,config files, blah blah blah.

So anyway, back to my problem... can anyone help or point to tutorial, etc...

My guess it's all down to the path in the .htaccess file? It's not clear whether it uses "/www/secure/.htaccess" or "/mnt/bootdev/etc...." or something entirely different!
Everyone of them mentions using "pwd" to get the path and it's always "/mnt/bootdev/blah/blah/www/secure/" and that's what I've been using mostly, but I have tried "/www/secure/".

Sorry for ranting on, but it's 2am and I've been tring to get it to work for 3+ hours.

Thanks in advance,
Alan.

PostPosted: Sat Oct 04, 2008 8:28 pm
by Lightning
Most likely your biggest problem is the main Apache configuration. Which is set by default to most ignor directory files and not allow changes. So do the following

edit /usr/local/apache/conf/httpd.conf
Code: Select all
#Find these lines and change "None" to "All"
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
# Change this
    AllowOverride None
# To this
    AllowOverride All


Then you can put the '.htaccess' file in the /www/secure directory.
This file should look something like this
Code: Select all
Deny from All
AuthType Basic
AuthUserFile /www/secure/.htpasswd
AuthName "Restricted Area"
Require valid-user
Satisfy any

The above configuration also assumes that the .htpasswd file will also be in that directory, but it can be elsewhere if you want.

PostPosted: Sun Oct 05, 2008 4:28 pm
by Alanex
It's now working brilliantly so thank you for your help.

cheers,
Alan.