logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache 2 Username/Password Protected Directories
Author
bcyork



Joined: 07 Aug 2014
Posts: 2
Location: chicgao,il

PostPosted: Thu 07 Aug '14 23:08    Post subject: Apache 2 Username/Password Protected Directories Reply with quote

Hi, I have been trying to get password protected directories working on my Linode server. It works / behaves in a desktop browser somewhat but not like I am used to with hostmonster. Also for some reason my phone (windows phone Cool just loads the page in the protected directory without prompting for a password. So I imagine there is some security thing I am missing that none of the info I have found searching talks about. Here is what I have done. I have created a password file and set the permissions correctly on that and it works on the desktop. However when I close the browser or open a private browsing session I am never prompted for a password again. It just feels insecure. Plus my windows phone just loads the page with no prompt. With hostmonster if I closed the browser window it would ask me for the username and password again. I also tested hostmonster directory passwords on my phone and it prompts for a username/password.

Here is what I have added to the apache2.conf file. The rest is pretty much default. There is no .htaccess file for that directory.


<Directory "/var/www/protected">
AllowOverride All
AuthType basic
AuthName "Enter Login"
AuthUserFile /etc/htpasswd/.htpasswd
Require valid-user
Order deny,allow
Allow from user1
</Directory>

It may be worth noting that I have two virtual sites / domain names running on this server at the moment however the one that is being used for this is the primary domain name.

OS: Debian 7.3
Apache 2.2.22

Thanks!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 13 Aug '14 18:14    Post subject: Reply with quote

Please try

<code>
<Directory "/var/www/protected">
AllowOverride none
AuthType basic
AuthName "Enter Login"
AuthUserFile /etc/htpasswd/.htpasswd
Require valid-user
</Directory>

</code>
Back to top
bcyork



Joined: 07 Aug 2014
Posts: 2
Location: chicgao,il

PostPosted: Wed 13 Aug '14 20:31    Post subject: Reply with quote

Still does the same. Loads without asking for a password on Windows Phone and doesn't ask for a password since I entered a few days ago in Chrome and IE.

Also apache service was restarted after editing config file.
Back to top
puertoblack2003



Joined: 31 Jul 2009
Posts: 121
Location: U.S

PostPosted: Thu 14 Aug '14 5:30    Post subject: Reply with quote

I've been having the same issue since upgrading to 2.4 now.It works if it go to http://mywebsite.com/myfolder, the pop up box appears, but if i go to http://mywebsite.com/myfolder/index.php the box wont pop up to enter username and password

searching the web has no results...
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Fri 15 Aug '14 0:04    Post subject: Reply with quote

bcyork wrote:
Still does the same. Loads without asking for a password on Windows Phone and doesn't ask for a password since I entered a few days ago in Chrome and IE.

Also apache service was restarted after editing config file.
Did you try rebooting the Windows Phone?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 15 Aug '14 15:50    Post subject: Reply with quote

Jan-E wrote:
Did you try rebooting the Windows Phone?


I agree, even if a windows phone usually never needs a reboot. Mine is on over a year.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Fri 15 Aug '14 17:52    Post subject: Reply with quote

The reason I asked to reboot is because http-authentication has some quirks. In some browsers you can force a logout, in some not.

http://code.google.com/p/chromium/issues/detail?id=5497
https://bugzilla.mozilla.org/show_bug.cgi?id=287957

Rebooting might be a way to clear the authentication cache.

Edit: just tested http-authentication in IE11 on Win7. Only completely closing the browser clears the authentication. If a windows phone keeps an instance of the browser open at all times, rebooting is the only way to be sure that the browser closes for a moment.
Back to top


Reply to topic   Topic: Apache 2 Username/Password Protected Directories View previous topic :: View next topic
Post new topic   Forum Index -> Apache