Basic Authentication is analogous to simply "closing a door" to parts of your Web site. It will prevent the casual or polite users from "opening the door", but will not prevent someone mildly determined to walking in.
Two issues that contribute to the lack of security and privacy are:
fas% telnet 140.247.30.64 80 Trying 140.247.30.64... Connected to 140.247.30.64. Escape character is '^]'. HEAD /~cscie12/assignments/ HTTP/1.1 Host: www.courses.fas.harvard.edu HTTP/1.1 401 Authorization Required Date: Mon, 22 Nov 1999 17:42:29 GMT Server: Apache/1.3.6 (Unix) mod_perl/1.21 secured_by_Raven/1.4.1 WWW-Authenticate: Basic realm="CSCIE12 Assignment Submission"
fas% telnet 140.247.30.64 80
Trying 140.247.30.64...
Connected to 140.247.30.64.
Escape character is '^]'.
HEAD /~cscie12/assignments/ HTTP/1.1
Host: www.courses.fas.harvard.edu
Authorization: BASIC Z3Vlc3Q6a25vY2trbm9jaw==
HTTP/1.1 200 OK
Date: Mon, 22 Nov 1999 17:46:42 GMT
Server: Apache/1.3.6 (Unix) mod_perl/1.21 secured_by_Raven/1.4.1
Author: David P. Heitmeyer
Content-Type: text/html
htpasswd program.htaccess filehtpasswd filehtgroup fileFor example, /home/j/h/jharvard/public_html/private/.htaccess will apply to all files contained within the ~jharvard/public_html/private directory (and its subdirectories), but would not be applied to the file ~jharvard/public_html/index.html.
This file needs to be readable by the Web Server.
This file should not lie within your public_html. It should reside at the root level of your home directory (for example, /home/j/h/jharvard/.htpasswd
This file needs to be readable by the Web Server.
fas% which htpasswd /usr/local/bin/htpasswd fas% htpasswd Usage: htpasswd [-c] passwordfile username The -c flag creates a new file.
fas% more ~cscie12/.htpasswd.demo guest:79WeSn3vYGsKQ guest2:wGcgIYLtHNIpM guest3:j9VzpSX/C8Kr2 guest4:CjHmW1PWNFwXM
This file should not lie within your public_html. It should reside at the root level of your home directory (for example, /home/j/h/jharvard/.htgroup
This file needs to be readable by the Web Server.
The following .htpasswd.demo and .htgroup.demo files are used:
/home/c/s/cscie12/.htpasswd.demoice% htpasswd Usage: htpasswd [-c] passwordfile username The -c flag creates a new file. ice% htpasswd -c /home/c/s/cscie12/.htpasswd.demo guest Adding password for guest New password: ***** Re-type password: *****
Contents of file:
guest:79WeSn3vYGsKQ guest2:PR4APgA.4CKO. guest3:5DbCMPbSDstj2 guest4:htPnr8jT4bI5E
.htgroup.demo
Contents of file:
VIP: guest guest4
The"AuthName" is the description that is displayed by the browser in the Basic Authentication dialog box.
Contents of sample .htaccess file:AuthName "Basic Authentication Tutorial 1" AuthType Basic AuthUserFile /home/c/s/cscie12/.htpasswd.demo require valid-user
Contents of sample .htaccess file:
AuthName "Basic Authentication Tutorial 2" AuthType Basic AuthUserFile /home/c/s/cscie12/.htpasswd.demo require user guest2 guest3
Unauthorized:
guest:guest
guest4:guest
Contents of .htaccess file:
AuthName "Basic Authentication Tutorial 3" AuthType Basic AuthUserFile /home/c/s/cscie12/.htpasswd.demo AuthGroupFile /home/c/s/cscie12/.htgroup.demo require group VIP
Contents of .htgroup.demo file:
VIP: guest guest4
Unauthorized:
guest2:guest
guest3:guest
Contents of sample .htaccess file:
order deny,allow deny from all allow from 140.247 allow from 128.103 allow .harvard.edu
Contents of sample .htaccess file:
order allow,deny allow from all deny from .fas.harvard.edu
Contents of sample .htaccess file:
order deny,allow deny from all allow from .yale.edu AuthType Basic AuthUserFile /home/c/s/cscie12/.htpasswd.demo AuthName "Basic Authentication Tutorial 6" require valid-user satisfy any
Contents of sample .htaccess file:
order deny,allow deny from all allow from .harvard.edu AuthType Basic AuthUserFile /home/c/s/cscie12/.htpasswd.demo AuthName "Basic Authentication Tutorial 7" require valid-user satisfy all