The previous article describes how to use Apache to implement a method that disables directory access (the list of directories or files listed), prohibits or allows IP and domain names to access directories. In fact, using the. htaccess and Apache HTPASSWD commands to generate encrypted password files to configure the relevant directory, you can also achieve access to the directory control, such as login Admin directory when entering user name and password. Today, let's share Apache HTPASSWD commands on how to use the Apache htpasswd command usage introduction.
1, under the Apache installation directory bin found Htpasswd.exe
2, in the command line Input htpasswd-help command, display Apache HTPASSWD command Help information, attention needs to Htpasswd.exe in the current directory, that is, Apache\bin directory to use the HTPASSWD command
Apache htpasswd command usage and options description
Apache htpasswd help Command description
Apache htpasswd Command usage
htpasswd [-CMDPSD] passwordfile username
HTPASSWD-B[CMDPSD] passwordfile username password
Htpasswd-n[mdps] Username
HTPASSWD-NB[MDPS] Username password
Apache htpasswd Command option parameter description
-C Create an encrypted file
-N Do not update the encrypted file, only the user name password encrypted with the Apache HTPASSWD command is displayed on the screen
-M default Apache HTPASSSWD command uses MD5 algorithm to encrypt passwords
The-D Apache htpassswd command uses the crypt algorithm to encrypt passwords
-P Apache htpassswd command does not encrypt passwords, i.e. plaintext passwords
-S Apache htpassswd command uses the SHA algorithm to encrypt passwords
-B Enter the username and password together with the Apache HTPASSSWD command line instead of prompting for a password
-D deletes the specified user
The '-m ' option in Windows, NetWare and TPF systems is default and can be ignored when using the Apache htpasswd command. In other systems, the '-P ' option may not work.
Apache htpasswd Command Usage instance
1, how to use the HTPASSWD command to add users.
HTPASSWD-BC. passwd www.leapsoul.cn php
Generates a. passwd file in the bin directory, username www.leapsoul.cn, Password: PHP, by default MD5 encryption method
2, how to add the next user in the original password file.
Htpasswd-b. passwd Leapsoul Phpdev
Remove the C option to add a second user after the first user, and so on
3, how not to update the password file, only the encrypted user name and password display.
HTPASSWD-NB Leapsoul Phpdev
Do not update the. passwd file, only the user name and the encrypted password are printed on the screen
4, how to use the htpasswd command to delete the user name and password.
htpasswd-d. passwd Leapsoul
5, how to use the HTPASSWD command to modify the password.
htpasswd-d. passwd Leapsoul
Htpasswd-b. passwd Leapsoul Phpdev
That is, use the htpasswd Delete command to remove the specified user, and then use the htpasswd Add User command to create a user to implement the ability to modify the password.
At this point, the Apache htpasswd command of the specific introduction and use of the method is finished.