As many of us may know the importance of .htpasswd file while configuring the .htaccess file as it contains all the usernames and passwords of those people who should be grant access to the directories and subdirectories of a particular website.
It is necessary to telnet into your web hosting server before creating this file.
Go into the directory and using cd command, you can specify your ‘AuthUserFile’ (/var/www/html/private/)
Type htpasswd -c .htpasswd username for creating the .htpasswd file and adding the username to the list which contains users to be authorized for accessing the directory and subdirectories. This program will automatically as you for a password and later on its verification also. Refer to the following window.
[root@www /root]# cd /var/www/html/private/
[root@www private]# htpasswd -c .htpasswd username
Re-type new password:
Adding Password for user username
For adding new user you can use the same command without ‘-c’ switch.(For adding user ‘User1008’ type htpasswd .htpasswd User1008. )
For deleting user you should open .htpasswd file and by using any unix editor you can use dlete the row related with that particular user to be removed.