Apache htpasswd option Parameters
Htpasswd [-javaspsd] passwordfile username
Htpasswd-B [javaspsd] passwordfile username password
Htpasswd-n [mdps] username
Htpasswd-nb [mdps] username password
Parameters of the apache htpasswd command
-C. Create an encrypted file
-N: If the encrypted file is not updated, only the user name and password encrypted by the apache htpasswd command are displayed on the screen.
-M by default, the apache htpassswd command uses the MD5 Algorithm to encrypt the password.
-D the apache htpassswd command uses the CRYPT algorithm to encrypt the password.
-P apache htpassswd command does not encrypt the password, that is, the plaintext Password
-S apache htpassswd command uses SHA algorithm to encrypt the password
-B enters the user name and password in the apache htpassswd command line instead of entering the password as prompted.
-D. Delete the specified user.
In Windows, the '-m' option is the default in NetWare and TPF systems. You can ignore it when using the apache htpasswd command. In other systems, the '-p' option may not work.
Apache htpasswd example
1. How to Use the htpasswd command to add a user?
Htpasswd-bc. passwd tonyzhang pass
Generate a. passwd file in the bin directory, with the username tonyzhang and password: pass. MD5 encryption is used by default.
2. How to add the next user to the original password file?
Htpasswd-B. passwd onlyzq pass
Remove the c option to add a second user after the first user.
3. How can I only display the encrypted user name and password without updating the password file?
Htpasswd-nb tonyzhang pass
Do not update the. passwd file. Only output the user name and encrypted password on the screen.
4. How can I use the htpasswd command to delete the user name and password?
Htpasswd-D. passwd tonyzhang
5. How can I use the htpasswd command to change the password?
Htpasswd-D. passwd tonyzhang
Htpasswd-B. passwd tonyzhang pass
You can use the htpasswd DELETE command to delete a specified user, and then use the htpasswd add USER command to create a user to change the password.