Help - Search - Members - Calendar
Full Version: .htaccess
The Planet Forums > Security > General Security > UNIX Security
tommygunner
I'm trying to get .htaccess working for password protection and have the password popup coming up but even though I enter the correct username and password, it won't accept it. Here is what my .htaccess file looks like.

AuthUserFile /pathtopasswords/.htpasswd
AuthType Basic
AuthName "Password Required"
require valid-user
OllieMaitland
I suspect that if you get the authentication box then you problem lies in the .htpasswd file rather than in this .htaccess file.

What is the contents of your .htpasswd file?

If you want to create a new user (and new file) you can run:

CODE
htpasswd -c /pathtopasswords/.htpasswd username


or to add one to an existing file:

CODE
htpasswd /pathtopasswords/.htpasswd anotheruser


You .htpasswd file should look something like this:

CODE
username:XgYgQDm8Itpe2


If you manually created the file in old versions of Apache i think you had to have a newline break after the last username and password line.
tommygunner
Well the password is encrypted like what you have shown. The password works in other versions of apache just not the one included in RHEL up2date.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.