In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Linux how to use the htpasswd command to create password files, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Htpasswd
The htpasswd directive is used to create and update user authentication password files for basic authentication. The htpasswd directive must have read and write access to the password file, otherwise an error code will be returned.
The scope of application of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora.
1. Grammar
Htpasswd [- c] [- m] [- D] passwdfile username
Htpasswd-b [- c] [- m |-d |-p |-s] [- D] passwdfile username password
Htpasswd-n [- m |-d |-s |-p] username
Htpasswd-nb [- m |-d |-s |-p] username password
2. Parameter list
Option
Description
-b
Use batch processing to get the password directly from the command line without prompting the user for input
-c
Create a password file, and if the file exists, the content is emptied and rewritten
-n
Send the results to standard output
-m
Use MD5 encryption
S
Use crypt () encryption
-p
Use text password
-D
Delete the user record from the authentication file
3. Examples
1) create a basic authentication file
[root@localhost ~] # htpasswd-cm htpfile1 weijie / / create authentication file and use md5 encryption
New password:
Re-type new password:
Adding password for user weijie
You have new mail in / var/spool/mail/root
[root@localhost ~] # cat htpfile1 / / display authentication file
Weijie:$apr1 $/ RxQ5LT9 $L1WJPkxknMizG5DwGVGv4.
2) create a basic authentication file and use a text password
[root@localhost ~] # htpasswd-cp htpfile2 weijie / / create an authentication file using a text password
Warning: storing passwords as plain text might just not work on this platform.
New password:
Re-type new password:
Adding password for user weijie
[root@localhost ~] # cat htpfile2 / / View the authentication file and you can see the password
Weijie:123456
After reading the above, have you mastered how to use the htpasswd command to create a password file in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.