cancel
Showing results for 
Search instead for 
Did you mean: 

htaccess password Linux

Duffs
Regular Advisor

htaccess password Linux

Hi,

Running Redhat AS Release 4 here.....

I've setup a .htaccess file /var/www/html/.htaccess

AuthType Basic
AuthName "restricted stuff"
#AuthUserFile /home/secure/.htpasswd
AuthUserFile /var/www/html/.htpasswd
Require user duffs

I've also setup a passwords file /var/www/html/.htpasswd

duffs:zADvPn52quUMM

And I've also modified the /etc/httpd/httpd.conf file directory:


Options None
AllowOverride All
Order allow,deny
Allow from all
AuthType Basic
AuthName "restricted stuff"
#AuthUserFile /home/secure/.htpasswd
AuthUserFile /var/www/html/.htpasswd/
Require user admin


I then stopped and restarted httpd

Now... it DOES prompt for a username/password - however it never accepts it. It just keeps prompting me for a username/password. I've even deleted and recreated the password file like so:

htpasswd -c /usr/local/apache/password/passwords username

I'm 100% sure of the username/password - but it never lets me in!!!!

Any ideas?

R,
D.
5 REPLIES
Ivan Ferreira
Honored Contributor

Re: htaccess password Linux

Try with mod_auth_dbm or mod_authn_dbm depending of your apache version.


AuthType Basic
AuthName "My Private Files"
AuthDBMUserFile /var/www/authdb
AuthDBMType DB
require valid-user


# htdbm -b -TDB authdb username password
# htdbm -l -TDB authdb

Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: htaccess password Linux

Shalom,

I will confirm the changes in httpd.conf are required to get this function working.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Duffs
Regular Advisor

Re: htaccess password Linux

Hi,

Excuse my lack of apache familiarity here but I have made the changes that I think you were recommending (below); maybe you can confirm where I have gone wrong here?


Options None
AllowOverride All
Order allow,deny
Allow from all
AuthType Basic
AuthName "restricted stuff"
#AuthUserFile /var/www/html/.htpasswd/
AuthDBMUserFile /var/www/authdb
AuthDBMType DB
Require user duffs


#htdbm -b -TDB /var/www/authdb duffs duffs
Error opening database /var/www/authdb
APR does not understand this error code
Duffs
Regular Advisor

Re: htaccess password Linux

Hi,

Case resolved. The modules that you recommended were not actually required and after some deliberation discovered that the configuration actually worked when I changed the '' directive to ''.

Thanks anyway for the responses.

Duffs

Duffs
Regular Advisor

Re: htaccess password Linux

Case resolved as outlined above.
R,
D.