Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 6th, 2011, 02:49 AM
redhat19 redhat19 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 6 redhat19 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 41 sec
Reputation Power: 0
general - Request for help with .htpasswd and .htaccess files

Hi all,

I am trying to create a passworded folder on my web server using Apache .htaccess and .htpasswd.
I just keep getting the prompt to log in and when I put in the user name and password I specified in those files, my login always returns unsuccessful.
Here are the contents of the files.
Content of .htaccess file:
-----------------------------------------------------------------------
AuthType Basic
AuthUserFile "/htdocs/…./.htpasswd"
AuthName “Enter valid username and password!”
require valid-user
------------------------------------------------------------------------

Content of the .htpasswd file:
--------------------------------------------
myname: abcdef123
--------------------------------------------

In a bid to resolve the problem, I have used various encryption tools to encrypt the password in the .htpasswd and I have used these:
myname:1$.2iDtIZW/cg
myname:$apr1$6qpmb1a3$H10LASGeIvQVfslXOLn4G1
myname:$apr1$XhKhUnQT$tqaPs6J9qBZMJsipFQnnq.

…but I got the same result.

In case it will help, my Apache Version Number is 2.2.3.
Why can't I log in?
Any help suggestions will be appreciated.

Thanks.

Reply With Quote
  #2  
Old December 6th, 2011, 05:21 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,233 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 15 m 56 sec
Reputation Power: 4445
Try putting the complete disk path to the .htpasswd file in your .htaccess
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #3  
Old December 7th, 2011, 05:43 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
None of those encryptions look right for the username and password you provide... using an online tool I get
Quote:
myname:hY/QrK1CTcOVw


try this generator.... http://www.kxs.net/support/htaccess_pw.html
__________________
Free MP3 Dance Music Downloads

To err is human; To really balls things up you need Microsoft!

Reply With Quote
  #4  
Old December 7th, 2011, 11:11 AM
redhat19 redhat19 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 6 redhat19 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 41 sec
Reputation Power: 0
Thanks a lot @1DMF, I used the tool/generator you referred me to to create a new password. I copied the user name and password combination that was generated to the .htpasswd file, but got the same result.
'Still doesn't log me in.

@Doug G
I had put the complete disk path to the .htpasswd file in the .htaccess file.
"/htdocs/…./.htpasswd" was just a short form for posting my question.

Reply With Quote
  #5  
Old December 7th, 2011, 12:25 PM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
Do you get a specific error?

What file attributes do you have on the .htaccess and .htpasswd files?

Reply With Quote
  #6  
Old December 8th, 2011, 02:13 AM
redhat19 redhat19 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 6 redhat19 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 41 sec
Reputation Power: 0
Thanks 1DMF.
THere is no error message given. The login screen just reappears.
How do I check the permissions on the files?
I use a windows desktop/laptop and can't at this time, set the permissions of the files using windows (since I'm using linux hosting to host the site).

I tried to check for the file permissions from the FTP interface, but the .htaccess file and the .htpasswd file are not being displayed.

Is there a way for me to check the file permissions on the shared linux hosting server?
What should the file permissions of these files be?

THanks

Reply With Quote
  #7  
Old December 8th, 2011, 05:14 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
I use FileZilla as an FTP client where I can upload my files and set file attributes.

If you cannot see your .htaccess file, how are you able to edit it or change it?

I have 644 set against mine and it seems to work fine.

I assume you have the .htaccess file in the same folder as the one you are trying to password protect?

Reply With Quote
  #8  
Old December 8th, 2011, 10:36 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,233 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 15 m 56 sec
Reputation Power: 4445
Have you checked your http log files? Usually there will be something in the apache error log when a .htaccess auth request fails.

Reply With Quote
  #9  
Old December 8th, 2011, 03:26 PM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,830 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 16 h 41 m 29 sec
Reputation Power: 4192
Quote:
Originally Posted by redhat19
I tried to check for the file permissions from the FTP interface, but the .htaccess file and the .htpasswd file are not being displayed.

You may need to configure your FTP client (the Windows program you're using) to display hidden files. (On Linux and Unix systems, the "." at the start of a file name indicates that it's a hidden file.)
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
  #10  
Old December 9th, 2011, 05:21 AM
redhat19 redhat19 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 6 redhat19 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 41 sec
Reputation Power: 0
Hi Guys, thanks for all the help.
@Doug G: Is it possible to check the http log files on my account on a shared hosting server? (cos that’s what I’m using).
@1DMF: Yes, I have the .htaccess file and the .htpasswd file in the same folder.
I used FileZilla too and couldn’t see the .htaccess and .htpasswd files… until I read @Kravvitz’s post, which made me know I could force the FTP client to display hidden files on the server.
@Kravvitz: Thanks for your reply. I didn’t know I could force the FTP client to display hidden files. When I eventually did, I was able to view the files, but…
The file permissions on my .htaccess and .htpasswd files were 664, like @1DMF recommended, but it was still not working. I have changed the permissions around back and forth and its still not working. What’s supposed to be the recommended file permissions on the .htpasswd file? (Although, in trying out all the permissions settings, I’m almost sure I have already tried it..and still couldn’t get it to work).

Reply With Quote
  #11  
Old December 9th, 2011, 06:52 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
without stating the obvious, but if you have the right permission (644) , you have no mod_rewrites or other stuff affecting the .htaccess file
Code:
AuthName "Your Auth Name"
AuthType Basic
AuthUserFile /your/full/path/public_html/etc../.htpasswd
require valid-user


and the .htpasswd
Code:
USERID:encryptedpwd


Are you sure you are typing userid & password in the correct case as *nix is case sensitive?

I can't think of anything else, it worked 1st time for me on my shared hosting?

Reply With Quote
  #12  
Old December 9th, 2011, 07:12 AM
redhat19 redhat19 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 6 redhat19 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 41 sec
Reputation Power: 0
Hi 1DMF

Thanks for all the help.
Yes, I was typing the encrypted password with all the cases. I even copied and pasted.
After reading your post, I realized I was doing everything right..
So, I tried this:
USERID:

(i.e I left the password field blank)

..and it worked.

So, I guess its something to do with the kind of encryption I'm using.
..and I was using the encryption tool at the URL you had pointed me to earlier.

Reply With Quote
  #13  
Old December 9th, 2011, 03:51 PM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
I'd check the case you typed when using the encryption tool for both UserID and password.

It might be as simple a mistake as that?

Reply With Quote
  #14  
Old December 9th, 2011, 04:48 PM
DonR DonR is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 460 DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)DonR User rank is Captain (20000 - 30000 Reputation Level)  Folding Points: 29722 Folding Title: Starter FolderFolding Points: 29722 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 21 h 57 m 10 sec
Reputation Power: 216
one other thing is to make sure, in your ftp client, that you upload your .htpasswd and .htaccess files as ASCII and not BINARY.
Most ftp clients should take of this for you, but, its worth mentioning I think.

Reply With Quote
  #15  
Old December 15th, 2011, 05:24 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
So was this resolved?

Do you have any feedback?

Can you help others with similar problems by letting them know what you did?

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > general - Request for help with .htpasswd and .htaccess files

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap