httpd htpasswd Command

Source: Internet
Author: User
Tags crypt diff md5 encryption

HTPASSWD is used to generate a password based on Web user authentication for a specified user, provided by the Httpd-tools package. Supports 3 encryption algorithms: MD5, Sha, and the Crypt () function on the system, which defaults to MD5 when no algorithm is specified.

HTPASSWD [-c] [-m] [-d] Passwdfile usernamehtpasswd-b [-c] [-M |- D| -P |- S] [-d] passwdfile username passwordhtpasswd-n [-m |- D|- S| -P] usernamehtpasswd-nb [-M |- D|- S| -p] Username password option Description: passwdfile: The user password file that contains the user name and its password. If you use the"-C"option, the file is created or overwritten. Do not use"-N"option, you must specify the Passwdfile parameter. Username: Creates a password for the specified user name. If the user record already exists, it is updated. -C: Creates the user password file Passwdfile, overwriting the existing file if the file already exists. Can't and"-N"Used together. -N: Outputs the result in standard output instead of writing it to the user password file. This option ignores the user password file passwdfile parameter. Can't and"-C"option is used together. -M: Use the MD5 encryption algorithm. Default.- D: Using the Crypt () function to calculate the password is not secure.- S: Use the SHA encryption algorithm. Safety. -P: Force unencrypted password, keep clear text state, not secure. -B: Force bcrypt encryption password, very safe. -D: Removes the specified user and their password from the user password file. -B: Use batch mode, or non-interactive mode, to pass plaintext passwords directly to be encrypted. Password: Specifies the plaintext password to be entered. Can only be used in batch mode, i.e., and"-B"Used together.

For example:

(1). Use the "-n" option to output the result directly to standard output without creating a passwdfile.

[[email protected] ~]# htpasswd -n JimNewnew password: Jim:ZKHud9tziGucY

(2). Use batch mode to pass passwords directly.

[root@xuexi ~]# htpasswd -nb Jim 123456 ; htpasswd -nb Jim 123456Jim:r.BF8RVw56BOAJim:xXoNgOS8nN3LQ

The discovery password is completely random.

(3). Create user password file passwdfile.

[root@xuexi ~]# htpasswd -cb Bobfile Bob 123456[root@xuexi ~]# cat Bobfile Bob:fvUxzB3kcnDPk

(4). Delete a user from the user's file.

[root@xuexi ~]# htpasswd -D Bobfile Bob

(5). Use the SHA and MD5 encryption algorithms to calculate the password.

[root@xuexi ~]# htpasswd -mb Bobfile Bob 123456[root@xuexi ~]# cat Bobfile Bob:$apr1$bllkodFt$GUmeb8hXngOAschs1SBgq0[root@xuexi ~]# htpasswd -sb Bobfile Bob 123456 [root@xuexi ~]# cat Bobfile  Bob:{SHA}fEqNCco3Yq9h5ZUglD3CZJT4lBs=

Back to Linux series article outline: http://www.cnblogs.com/f-ck-need-u/p/7048359.html
Back to Site Architecture series article outline: http://www.cnblogs.com/f-ck-need-u/p/7576137.html
Back to Database series article outline: http://www.cnblogs.com/f-ck-need-u/p/7586194.html
Reprint Please specify source: http://www.cnblogs.com/f-ck-need-u/p/8413490.html

Note: If you think this article is not bad please click on the lower right corner of the recommendation, your support can inspire the author more enthusiasm for writing, thank you very much!

httpd htpasswd Command

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.