Find the answer to your Linux question:
Results 1 to 4 of 4
Im trying to password protect a folder on my webserver. I have everything working i.e. it asks for the username and password when I try to access the folder but ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2004
    Posts
    30

    Problem getting .htaccess working


    Im trying to password protect a folder on my webserver. I have everything working i.e. it asks for the username and password when I try to access the folder but when I enter them, it says the password or username is wrong (it is not, I have checked many, many times). I thought maybe apache doesn't have the rights to the .htpasswd file so i did a "chown root:apache .htpasswd" on it, but that didnt help.

    This is my .htaccess files contents:

    Code:
    AuthUserFile /usr/local/apache2/htdocs/private/.htpasswd
    AuthGroupFile /dev/null
    AuthName "private area"
    AuthType "Basic"
    
    <Limit GET POST>
    require valid-user
    </Limit>
    Yes, my .htpasswd file is located in /usr/local/apache2/htdocs/private. To create the user I made the file with the command htpasswd -c .htpasswd username, and it said user and password created.

    Do I need to set some permissions or what? Please help, this is driving me nuts.

  2. #2
    Just Joined!
    Join Date
    Feb 2004
    Posts
    30
    bump

  3. #3
    Just Joined!
    Join Date
    Sep 2004
    Posts
    21
    u shoud change the group and not the owner of the file
    .htpasswd tp apache. and give the read permission or whatever
    u want to give , give to the group.

    try these these commands..

    # htpasswd -mc .htpasswd username
    # chgrp apache .htpasswd
    # chmod g+r .htpasswd

    besides this make an entry in httpd.conf
    inside the <Directory> block..

    AllowOverride AuthConfig


    Regards
    KeenLearner

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Sep 2004
    Posts
    1

    problem with htaccess...

    the problem is with the encryption algorithm used be htpaccess
    you might use this perl script to generate the password for .htaccess file.
    http://www.cse.iitd.ernet.in/~csd00377/misc/addpw.pl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •