Help - Password protecting directories

Connect with other users about what to run on your webhosting (and how to run it) here.
winds
A semi-regular
A semi-regular
Posts: 19
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sat Jan 08, 2011 8:23 pm

Help - Password protecting directories

Post by winds »

Hey guys,
I am following the instructions here: http://www.nfoservers.com/forums/viewto ... =19&t=3736 however I must have done something wrong and can't figure out what.

After following those instructions I attempted to login to my password protected directory, but instead it brought me to my custom error page. Now when I try to access that directory again it brings me straight to the error page, without letting me attempt to login again. I am fairly confident that I used the correct login information that I used.

The only thing I can think of is when I created the password hash, I ticked the MD5 box. Am I not supposed to?

Cheers!
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Help - Password protecting directories

Post by Edge100x »

Yes, you will need to use a regular password and not an MD5 one.
winds
A semi-regular
A semi-regular
Posts: 19
Joined: Sat Jan 08, 2011 8:23 pm

Re: Help - Password protecting directories

Post by winds »

Thanks,
However now I seem to be locked out of the directory haha. Anytime I try to go to it, it takes me to my error page.
If I disable the .htaccess and .htpasswd files then I can access it, but while theyre enabled it wont let me.
winds
A semi-regular
A semi-regular
Posts: 19
Joined: Sat Jan 08, 2011 8:23 pm

Re: Help - Password protecting directories

Post by winds »

Okay I was able to generate a normal hash and not an MD5 hash. I uploaded that to my .htpasswd and tried to access the directory again, but it still didn't work. I used the login info I made and it still sent me to my error page.

Not quite sure what i'm doing wrong at this point. In the .htaccess, for this line:
AuthUserFile /usr/www/USERNAME/DIRECTORY_TO_PROTECT/.htpasswd

Username is the username given to me by nfo for the ftp to my website, correct?

Then in .htpasswd for this line:
LOGIN_NAME:HASHED_PASSWORD

LOGIN_NAME is anything I want it to be, correct? I can make one up?
Then HASHED_PASSWORD, I made a new password, put it in the hash generator, then copy pasted the Hashed password.

Anything i'm doing wrong?
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Help - Password protecting directories

Post by Edge100x »

winds wrote:Username is the username given to me by nfo for the ftp to my website, correct?
Yes, that's correct. It is your identifier (all lowercase).
LOGIN_NAME is anything I want it to be, correct? I can make one up?
Yes.
Then HASHED_PASSWORD, I made a new password, put it in the hash generator, then copy pasted the Hashed password.
That is correct, yes.
winds
A semi-regular
A semi-regular
Posts: 19
Joined: Sat Jan 08, 2011 8:23 pm

Re: Help - Password protecting directories

Post by winds »

Hm, so it seems I did everything correctly. Any idea why I wouldn't be able to log in successfully?
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Help - Password protecting directories

Post by Edge100x »

Could you post your .htaccess and .htpasswd full files here?
winds
A semi-regular
A semi-regular
Posts: 19
Joined: Sat Jan 08, 2011 8:23 pm

Re: Help - Password protecting directories

Post by winds »

No problemo,
I had to rename them to .txt to upload them, but in the ftp theyre renamed to .htaccess and .htpasswd. I also edited just the FTP login part and the directory, to avoid problems, but they are indeed correct on my ftp.

htaccess
htpasswd
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Help - Password protecting directories

Post by Edge100x »

You can just paste them directly here, in

Code: Select all

 blocks :). Easier, faster, and more permanent than doing an attachment or uploading them somewhere else.
winds
A semi-regular
A semi-regular
Posts: 19
Joined: Sat Jan 08, 2011 8:23 pm

Re: Help - Password protecting directories

Post by winds »

Ahhh right, haha, my bad!

htaccess

Code: Select all

# Access file
order allow,deny
allow from all
require valid-user
Authname "DirectoryName"
Authtype Basic
AuthUserFile /usr/www/website/admin/.htpasswd
htpasswd

Code: Select all

admin:ghfN47dN7cEUo
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Help - Password protecting directories

Post by Edge100x »

Hmm, that does appear to be correct.
winds
A semi-regular
A semi-regular
Posts: 19
Joined: Sat Jan 08, 2011 8:23 pm

Re: Help - Password protecting directories

Post by winds »

When logging into the directory, with those files, my login details would be:
Username: admin
Password: the password I typed in to get hashed, not the actual hashed password, right?

I don't know what else I could be doing wrong. Tried many times without success.
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Help - Password protecting directories

Post by Edge100x »

Yes, that's correct.
winds
A semi-regular
A semi-regular
Posts: 19
Joined: Sat Jan 08, 2011 8:23 pm

Re: Help - Password protecting directories

Post by winds »

Hmm, do you have any ideas why it wouldn't be working?
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Help - Password protecting directories

Post by Edge100x »

Not very many, unfortunately. You could triple-check that the files are in the right places and with the right permissions, and make sure that there isn't a .htaccess in another folder that's changing the URL.
Post Reply