Apache command htpasswd to generate authuserfile

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.