Slime: Apache Password generation tool HTPASSWD application

Source: Internet
Author: User
Tags md5 encryption

This article by show according to Lin Feng to provide friendship sponsorship, starting in the mud row world.

1, the role of htpasswd and installation

2, htpasswd command detailed

3. Examples of htpasswd

4, the application of htpasswd

First, the role of htpasswd and installation

HTPASSWD is a tool for Apache, which is primarily used to create and update text files that store user names and passwords, primarily for authentication based on HTTP users.

The installation of htpasswd is simple, and it is built with Apache installation. This is the same as the AB tool, if any child shoes do not understand where you can view the "slime: Apache Performance Test Tool AB Application" this article.

If Apache is installed by using the RPM Yum method, the command is stored in the/usr/bin/directory, as follows:

Which htpasswd

/usr/bin/htpasswd

If Apache is installed in source mode, the command is stored in the bin directory of the Apache installation directory, as follows:

/usr/local/apache2/bin

HTPASSWD command usage, we can be viewed through the help of HTPASSWD, as follows:

Htpasswd-h

Second, the HTPASSWD command detailed

In the first section, we looked at the help information for HTPASSWD. Now let's explain the relevant parameters in the Help information.

HTPASSWD's help information is as follows:

Htpasswd-h

htpasswd [-CMDPSD] passwordfile username

HTPASSWD-B[CMDPSD] passwordfile username password

Htpasswd-n[mdps] Username

HTPASSWD-NB[MDPS] Username password

HTPASSWD command option parameter description:

-C Create an encrypted file.

-N does not update the encrypted file, only the user name and password that are encrypted by the HTPASSWD command are displayed on the screen.

The-M default htpassswd command encrypts the password using the MD5 algorithm, which is not available by default.

-D indicates that the HTPASSSWD command encrypts the password using the crypt algorithm.

-S indicates that the HTPASSSWD command uses the SHA algorithm to encrypt the password.

-P indicates that the HTPASSSWD command does not encrypt the password, which is the plaintext password.

-B means entering the user name and password on the HTPASSSWD command line instead of prompting for the password.

-D means to delete the specified user.

Iii. Examples of htpasswd

In the second step, we list the parameter descriptions for HTPASSWD, and now we'll show you how to use them with examples.

3.1 add a user with the HTPASSWD command

With the HTPASSWD command to add a user, we can use the-B and-C parameters. As follows:

HTPASSWD-BC ilannifile Ilanniuser 123456

Cat Ilannifile

HTPASSWD-BC ilannifile Ilanniuser 123456

Indicates that a ilannifile password file is generated under the current directory and a new user named Ilanniuser password 123456 is added, which is encrypted by default with MD5 encryption.

3.2 new user in legacy password file

To add a new user to the original password file, we can use the-b parameter. As follows:

Htpasswd-b ilannifile ilannitwo 123456

Cat Ilannifile

Htpasswd-b ilannifile ilannitwo 123456

Indicates that a user named Ilannitwo with a password of 123456 is added to the ilannifile password file.

Note: the-c parameter must not be added at this point, otherwise it will overwrite the original password file and create a new password file.

3.3 do not update the password file, only display the encrypted user name and password

Instead of updating the password file, only the encrypted user name and password are displayed, we can use the-n parameter. As follows:

Htpasswd-n Ilannitwo

Note the-n parameter must be followed by a user who already exists in the password file. To tell the truth, this parameter doesn't have much practical significance.

3.4 Use the htpasswd command to delete a user name and password

To delete a user who already exists in the password file, we can do so with the-D parameter. As follows:

htpasswd-d Ilannifile Ilannitwo

3.5 To modify a user's password with the HTPASSWD command

To achieve this, we need to use the htpasswd command to delete the specified user, and then use HTPASSWD to create the user can implement the ability to modify the password. As follows:

Iv. Application of HTPASSWD

HTPASSWD can be integrated with Nagios, SVN, Nginx, Apache, and so on, which we don't introduce. We will follow up on the integration of HTPASSWD with the above several programs separately.

Slime: Apache Password generation tool HTPASSWD application

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.