Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2003
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .htaccess Password help

    I'm trying to use .htaccess and .htpasswd to password protect a directory on my server. I've got it to where it will pop up with the box that asks for the un and pass, but no matter what I type in there, it wont accept it. I followed all the instructions on this website: http://wsabstract.com/howto/htaccess3.shtml but it is unclear about exactly what to do.. I'm not entirely sure what all information should go into the .htpasswd file, and exactly how it should be encoded. Any help would be appreciated.
    Where ever I go, that's where ever I am, and nobody knows it but me.

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    in the password file, you need to have your information formatted like:

    username:<encrypted password>

    There is program that comes with apache (or it should) that you can use for encrypting the passwords. I forget what it is called though.

    Be wary of the ones built into some websites, I tried using one and it didn't encrypt it right and I was pulling my hair trying to figure out what was wrong.
    OracleGuy

  • #3
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you have shell or telnet access to your server, and it is a nix variant, you can use the CRYPT function to create the passwords...

    htpasswd -c /path/to/your/.htpasswd username

    this will prompt you to enter a password for 'username' and append the usernameassword to your htpasswd file. Run man htpasswd at the command line for more info. Depending on your server, you may need to do something along the lines of

    /var/www/bin/htpasswd -c /path/to/your/.htpasswd username

    The two versions above are the apache version of encrypting, though there is a system version availble on nix variants of just plain old crypt()

    http://us2.php.net/crypt
    http://www.perldoc.com/perl5.8.0/pod/func/crypt.html
    http://httpd.apache.org/docs-2.1/en/.../htpasswd.html
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society


  •  

    Posting Permissions

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