|
Authentication: Introduction | Preparation | Directories | Secure Directories | Groups | Single Files | Secure Single Files |
| Basic Authentication |
Authentication Directories (Folders)
The previous page covered setting up four folders each with its own .htaccess file, protecting that folder and all its sub-folders. The current configuration protects each folder with a name and password. This page explores changes to the authentication directives used.
Password protecting directories requires the following elements:
root:root John:john123 Dave Smith:dave123 Mike:mike123 Jane:jane123 Dawn:dawn123 Ruth Smith:ruth123 |
File name: .htpasswd (The file can be named anything you like) |
AuthName "Uniform Server - Server Access" AuthType Basic AuthUserFile /htpasswd/www/.htpasswd Require user "Dave Smith" |
AuthName: (Displayed to a user) defines a realm name of a collection |
We currently have four folders being protected each contains its own .htaccess file. These differ only in the fourth line.
If you implemented the structure as explained on the previous page run the servers and test each folder for name password access:
Note: Once you have logged into to all four accounts you will not be challenged again you need to restart the browser to disconnect from server and repeat any tests.
Ruth Smith has decided to allow Dave Smith access to her protected folder. To implement this all that is required is to add Dave Smith to the fourth line ofher .htacces files:
Edit file: UniServer\udrive\www\ruth_smith\.htaccess as shown:
AuthName "Uniform Server - Server Access" AuthType Basic AuthUserFile /htpasswd/www/.htpasswd Require user "Ruth Smith" "Dave Smith"
Test:
Result:
Dave Smith has access to two accounts his own and Ruth's. He only needs to log in once to either of the accounts inorder to access the other.
The above has shown how easy it is to setup name/password protection on any folder.
On the next page I show how to secure these folders using SSL to encrypt names, passwords and content.
| | Ric |