Jump to content

.htaccess & .htpasswd


brittny85

Recommended Posts

I posted a couple days ago because I was trying to implement some passthrough authentication for a directory... but I've become less ambitious and I just want to protect the directory.  I've been trying to learn how to use the .htaccess & .htpasswd method, but I'm supremely confused.  I found a couple different sites that had .htpasswd generators... but each one gave me different results for the same username/password combination.  I tried using a few different variations of the encrypted password but no matter which one I used my server wouldn't authenticate me.  Am I missing something?  My .htaccess file looks like:
[code]AuthUserFile /Theronyx2/careers/resumes/.htpasswd
AuthGroupFile /dev/null
AuthName "Password Protected Area"
AuthType Basic

<limit GET POST>
require valid-user
</limit>[/code]

What should my .htpasswd file look like?  I know that the password is supposed to be encrypted, but how do I get the right encrypted password?

Thanks in advance!!
-Brittny
Link to comment
Share on other sites

Normally I would put this into my httpd.conf file such as

example:
<Directory "/home/members/mandrake-zone/ftp_isos">
AllowOverride AuthConfig
AuthType Basic
AuthName "Mandriva FTP Downloads"
AuthUserFile /path/to/.htpasswd
Require valid-user
</Directory>

if you do not have access to the httpd.conf file that as always it can be put into the .htaccess file using the same info as above.

remove the <limit GET POST></limit>

to create the .htpasswd file, from the command line type in

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

Note: the [b]-c[/b] is to create a new .htaccess file
[i]username[/i] is the name of the user you wish to add
if you already have a .htpasswd file and want to add more users to it use the following
htpasswd /path/to/your/existing/.htpasswd username

or if you are using windows you can use the form found here
http://www.flash.net/cgi-bin/pw.pl

copy the information and save it as .htpasswd
[b]Note/b] your file MUST have the peroid in front of the htpasswd
Link to comment
Share on other sites

Thank you for your help, but I'm still stuck.  I don't have access to the httpd.conf file so it is all in an .htaccess file.  I tried setting up my .htaccess file like you suggested, but that gave me a server error instead of just denying access.  I am working off of a windows machine currently, however once I get this working I will be uploading it to a Linux server.  Will I have to reconfigure the files for each server that the site is on?  I tried using that link to get the right .htpasswd file set up, but it didn't help either.  Sorry, I am trying to figure it out myself, but I can't find anything that tells me what I'm doing wrong.

Thanks again!
-Brittny
Link to comment
Share on other sites

[quote author=brittny85 link=topic=103919.msg414253#msg414253 date=1155338754]
Thank you for your help, but I'm still stuck.  I don't have access to the httpd.conf file so it is all in an .htaccess file.  I tried setting up my .htaccess file like you suggested, but that gave me a server error instead of just denying access.  I am working off of a windows machine currently, however once I get this working I will be uploading it to a Linux server.  Will I have to reconfigure the files for each server that the site is on?  I tried using that link to get the right .htpasswd file set up, but it didn't help either.  Sorry, I am trying to figure it out myself, but I can't find anything that tells me what I'm doing wrong.

Thanks again!
-Brittny
[/quote]

Sorry to hear that you still have problems.
Can you post the "denying access" error that you were orignally getting? Perhaps it will give me a clue on just how to correct your problem.

[quote]
Will I have to reconfigure the files for each server that the site is on?  I tried using that link to get the right .htpasswd file set up, but it didn't help either.
[/quote]

no you should not have to reconfigure the file.

that link  http://www.flash.net/cgi-bin/pw.pl

should of asked for a username and the password you wanted for that said user when you press the "encrypt" button it should of returned something in the form

example
atestfile:lfeo8vrSBxJ4.
this would be the part that would go into your .htpasswd file.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.