PDA

View Full Version : need help with .htaccess file


spie34
25th August 2004, 10:24 PM
trying to follow the qmailrocks howto and I have come up to this step which is not working out correctly for me. could someone point me in the right direction?
not sure if I am understanding this right or not
AuthType Basic
AuthUserFile /path/to/where/you/want/to/store/the/password/file/.htpasswd
AuthName vQadmin
require valid-user
satisfy any


So I can have it setup in /usr/local/apache/.htpassword correct?
Then I chown apache .htaccess then chmod 644 .htaccess

Next step that I am having a hard time figuring out is
htpasswd -bc /path/to/where/you/want/to/store/the/password/file/.htpasswd admin admin_password
so with this step I should be typing htpasswd -bc /usr/local/apache/conf/.htpasswd admin mypassword correct?
If so when I do that I am saying it cannot create file /usr/local/apache/conf.htpasswd

Jman
26th August 2004, 04:48 PM
Seems you have permissions problem. For sure the root user can write to that directory.

I would do this: htpasswd -c /path/to/where/you/want/to/store/the/password/file/.htpasswd admin It will then prompt you for the password for the admin user.

They're trying to do it on one line, which is a little confusing and less secure (you're typing the password on the command line).

See man htpasswd for a complete list of options.

tommytomato
30th August 2004, 12:35 PM

Try this out, if your using Fedora Core 1 or 2, it just a matter of working out the paths.
also note the password folder should be placed out side the home directory, also CMOD the password file to 666. do all this with root access.

Hope it helps



Password Protect web folders

Step 1
================================================== ================================
System is Trustix 2.1
================================================== ================================
Created a folder called ( protect ) /home/httpd/html/protect/
then add in the .htaccess file into the folder.
-------------------------------------------------------------------------
also put your web contect into the same folder /home/httpd/html/protect/
-------------------------------------------------------------------------

sample of .htaccess file below, use note pad and save as ( .htaccess )

----------------------------------

AuthType Basic
AuthName "You Wish Jelly Fish"
AuthUserFile /home/pass/passwords
Require user user_name user_name

----------------------------------

created a password file and place it into the folder called ( pass )

use note pad and save as ( passwords ) remove the .txt using a FTP program

folder is /home/pass

The run the htpasswd -c command

---------------------------------------------------
Sample: htpasswd -c /home/pass/passwords user_name
---------------------------------------------------

htpasswd will ask you for the password, and then ask you to type it again to confirm it

---------------------------------------------------------
# htpasswd -c /home/pass/passwords user_name
New password: mypassword
Re-type new password: mypassword
Adding password for user user_name
---------------------------------------------------------

Check your password file by doing this below
--------------------------------------------
vi /home/pass/passwords
--------------------------------------------

To add a new user to htpasswd please go to the directory were the file

# cd /home/pass
#htpasswd passwords demo

Step 2
==================================
Apache Configuration httpd.config
==================================

Open your httpd.config file /etc/httpd/conf/httpd.conf

vi /etc/httpd/conf/httpd.conf


at the bottom at this to the httpd.conf file

---------------------------------------

<DIRECTORY /home/httpd/html/protect>

AllowOverride AuthConfig

</DIRECTORY>

----------------------------------------

Now do a restart Apache web server

--------------------------
/etc/init.d/httpd restart
--------------------------



TT

jarmstrong
22nd December 2004, 03:43 AM
Hey,
I ran into the same problem, here too.
I was wondering if this worked for ya.

Jeff