APACHE AUTHENTICATION

APACHE AUTHENTICATION

 

It is used to authenticate the users.

 

Practical

<SERVER>

1) Go to configuration file and in VH Section add below lines

# vim /etc/httpd/conf/httpd.conf

               <VirtualHost 192.168.0.102:80>

               ServerAdmin webmaster@dummy-host.example.com

               DocumentRoot /opt/john

               ServerName first.com

               DirectoryIndex index.php

               ErrorLog logs/dummy-host.example.com-error_log

               CustomLog logs/dummy-host.example.com-access_log common

               <Directory /opt/john>                          (Website DocumentRoot)

               AuthUserFile /opt/john/private      (Store Non-VLU as well as VLU details)

               AuthType Basic

               AuthName “MY FILES”            (It’s a Banner)

               Require valid-user

               </Directory>

               </VirtualHost>

 

2) # /etc/init.d/httpd reload

 

3) # htpasswd -c /opt/john/private adam

     # htpasswd /opt/john/private will

(This command is used to create Non-VLU users to authenticate website. “-c” option is used only first time.)

·       <Directory> directive is a DocumentRoot/File System Level control.

·       AuthType(Encryption):

§  BASIC         : Plain Text

§  DIGEST : MD5 encryption (Mostly Used)

§  LDAP

§  MYSQL

·       AuthName: It is like a Banner

·       APACHE having 2 types of users:

§  valid-user

§  virtual user (Both user should have Apache user DB)

·       “Require” directive:

§  valid-user = VLU

§  virtual user = Non-VLU

·       We can create virtual user in Linux with “htpasswd” command.




<CLIENT>

1) Open Browser and type in address bar:

          http://first.com

 

Comments