|
Authentication: Introduction | Preparation | Directories | Secure Directories | Groups | Single Files | Secure Single Files |
| Basic Authentication |
Preparation
To explore directory authentication we require a few folders to work with. This page provides details for setting up a working structure including htaccess files I have purposefully kept the files as small as possible. We are not interested in great works of art hence the minimalist approach.
We are going to set-up a folder structure for the following users John, Dave Smith, Dawn and Ruth Smith as follows:
AuthName "Uniform Server - Server Access" AuthType Basic AuthUserFile /htpasswd/www/.htpasswd Require user John
Create a new text file index.html in folder john add the following text:
<html><head><title>John</title></head> <body><h1>John</h1> <p><a href="http://localhost/../">Home</a></p> <p><a href="http://localhost/../john/">John</a></p> <p><a href="http://localhost/../dave_smith/">Dave Smith</a></p> <p><a href="http://localhost/../dawn/"">Dawn</a></p> <p><a href="http://localhost/../ruth_smith/">Ruth Smith</a></p> </body></html>
AuthName "Uniform Server - Server Access" AuthType Basic AuthUserFile /htpasswd/www/.htpasswd Require user "Dave Smith"
Create a new text file index.html in folder dave_smith add the following text:
<html><head><title>Dave Smith</title></head> <body><h1>Dave Smith</h1> <p><a href="http://localhost/../">Home</a></p> <p><a href="http://localhost/../john/">John</a></p> <p><a href="http://localhost/../dave_smith/">Dave Smith</a></p> <p><a href="http://localhost/../dawn/">Dawn</a></p> <p><a href="http://localhost/../ruth_smith/">Ruth Smith</a></p> </body></html>
AuthName "Uniform Server - Server Access" AuthType Basic AuthUserFile /htpasswd/www/.htpasswd Require user Dawn
Create a new text file index.html in folder dawn add the following text:
<html><head><title>Dawn</title></head> <body><h1>Dawn</h1> <p><a href="http://localhost/../">Home</a></p> <p><a href="http://localhost/../john/">John</a></p> <p><a href="http://localhost/../dave_smith/">Dave Smith</a></p> <p><a href="http://localhost/../dawn/">Dawn</a></p> <p><a href="http://localhost/../ruth_smith/">Ruth Smith</a></p></body></html>
AuthName "Uniform Server - Server Access" AuthType Basic AuthUserFile /htpasswd/www/.htpasswd Require user "Ruth Smith"
Create a new text file index.html in folder dave_smith add the following text:
<html><head><title>Ruth Smith</title></head> <body><h1>Ruth Smith</h1> <p><a href="http://localhost/../">Home</a></p> <p><a href="http://localhost/../john/">John</a></p> <p><a href="http://localhost/../dave_smith/">Dave Smith</a></p> <p><a href="http://localhost/../dawn/">Dawn</a></p> <p><a href="http://localhost/../ruth_smith/">Ruth Smith</a></p> </body></html>
On the previous page we created a private server this restriction needs to be removed edit file UniServer\udrive\www\.htaccess comment the four authentication lines as shown.
#AuthName "Uniform Server - Server Access" #AuthType Basic #AuthUserFile /htpasswd/www/.htpasswd #Require user John "Dave Smith"
Create a new text file index.html in folder UniServer\udrive\www add the following text:
<html><head><title>Server</title></head> <body> <p><a href="http://localhost/john/"">John</a></p> <p><a href="http://localhost/dave_smith/">Dave Smith</a></p> <p><a href="http://localhost/dawn/">Dawn</a></p> <p><a href="http://localhost/ruth_smith/">Ruth Smith</a></p> </body></html>
Displays a page with links saves some typing during testing.
If you moved the servers see Multi-Servers remember to add the correct port numbers.
<html><head><title>Server</title></head> <body> <p><a href="http://localhost:81/john/"">John</a></p> <p><a href="http://localhost:81/dave_smith/">Dave Smith</a></p> <p><a href="http://localhost:81/dawn/">Dawn</a></p> <p><a href="http://localhost:81/ruth_smith/">Ruth Smith</a></p> </body></html>
The above folder structure is adequate for exploring authentication directives mentioned on the introduction page.
On the next page we explore the above structure and directory access.
| | Ric |