Thursday, July 3, 2014

Apache Web Server File based User Authentication

In this post we are going to cover file based authentication in Apache WebServer. In this user id and password can be stored in files and Webserver is going authenticate user for particular directory.

mod_auth_basic and mod_authn_file modules need to be loaded in httpd.conf file to make this work.

1) Add location tag (in httpd.conf) which you want to protect with following parameters.

< location /protected >
AuthType basic
AuthName "private area"
AuthBasicProvider file
AuthUserFile /var/authlist
Require valid-user< /location >

2) Create file specified above using following command.

cd /var

htpasswd -c authlist username1

Enter password and confirmation password for username1 which will be stored in authlist file in encrypted format.

3) To add new user use the command.

htpasswd authlist chinni

How to Remove users from Authentication? 

To remove user from the open authlist file and remove the userid and password.

Thanks !!! 

No comments:

Post a Comment

Other Posts