Go to the Apache/bin directory and enter:
Htpasswd-CMB user abc123456
You can generate a file in the current directory. the user name is ABC and the password is 123456 (encrypted ),
Or follow this step to generate
E:/web/apache2/bin> htpasswd-C userpass user1
Automatically using MD5 format.
New Password :******
Re-type new password :******
Adding password for user user1
Update Password:
E:/web/apache2/bin> htpasswd userpass user1
Automatically using MD5 format.
New Password :******
Re-type new password :******
Updating password for user user1
Add a new user:
E:/web/apache2/bin> htpasswd userpass user2
Automatically using MD5 format.
New Password :******
Re-type new password :******
Updating password for user user2
Open the file userpass and you can see two records:
User1: $ apr1 $ RR... $ lhobt0z67sp8heuks0b. B0
User2: $ apr1 $ PX ...... $ xqwtfgnlfvbgevqkbk8gt1
Delete A User:
Htpasswd-D userpass user1
Automatically using MD5 format
Deleting password for user user1
Open the file userpass and you can see that there is only one record:
User2: $ apr1 $ PX ...... $ xqwtfgnlfvbgevqkbk8gt1
Of course, you can also use some commands to generate. htaccess
E:/web/apache2/bin> htpasswd-C. htaccess user
Automatically using MD5 format.
New Password :******
Re-type new password :******
Adding password for user
Option:
-C. Create a new file
-M: use MD5 to encrypt the password
-B. Enter the password on the command line.
Usage:
Htpasswd [-javaspsd] passwordfile Username
Htpasswd-B [javaspsd] passwordfile Username Password
Htpasswd-N [MDPs] Username
Htpasswd-Nb [MDPs] Username Password
-C create a new file.
-N don't update file; display results on stdout.
-M force MD5 encryption of the password (default ).
-D force crypt encryption of the password.
-P do not encrypt the password (plaintext ).
-S force Sha encryption of the password.
-B use the password from the command line rather than prompting for it.
-D Delete the specified user.
On Windows, Netware and TPF systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.
E:/web/apache2/bin> htpasswd-MB user ABC 123456
Htpasswd: cannot modify file user; Use '-C' to create it
E:/web/apache2/bin> htpasswd-CMB user ABC 123456
Adding password for user ABC