RHEL6.3 implement encrypted-based user authentication and access authentication

Source: Internet
Author: User
I. Business Requirements Apache needs to implement encrypted authentication access based on user identity authentication to ensure the security of specific site pages. Here is the implementation process of the requirement. See the following breakdown. 2. Specific implementation steps: 1. Create the main directory and the webpage [root @ test1www] # mkdir1_1 [root @ test1www] # lscgi-binerror 1. Business Requirements
 
Apache requires encrypted access based on user identity authentication to ensure the security of pages on specific sites. Here is the implementation process of the requirement. See the following breakdown.
 
 
II. Specific steps:
 
1. Create a home directory and a webpage
 
[Root @ test1 www] # mkdir 1_1
 
[Root @ test1 www] # ls
 
Cgi-bin error html icons manual limit 1
 
[Root @ test1 www] # cd Protocol 1
 
[Root @ test1 limit 1] # echo "welcomt to apache website"> index.html
 
[Root @ test1 limit 1] # ls
 
Index.html
 
[Root @ test1 limit 1] # cat index.html
 
Welcomt to apache website
 
 
 
2. Use the htpasswd tool provided by apache to generate a password file as the source for user access authentication.
 
Format: htpasswd options FilePath user
 
-C: This option is used for the first creation.
 
-M: use MD5 encryption to Store Passwords
 
-D: delete a user from the password file.
 
 
 
[Root @ test1 conf] # htpasswd-cm. htpasswd aaa
 
New password:
 
Re-type new password:
 
Adding password for user aaa
 
[Root @ test1 conf] # cat. htpasswd
 
Aaa: $ apr1 $ hhFTA/vU $ GwUfNDRNGFGIyHWftqc2M1
 
[Root @ test1 conf] # htpasswd-m. htpasswd bbb
 
New password:
 
Re-type new password:
 
Adding password for user bbb
 
[Root @ test1 conf] # cat. htpasswd
 
Aaa: $ apr1 $ hhFTA/vU $ GwUfNDRNGFGIyHWftqc2M1
 
Bbb: $ apr1 $ QHr2Dpff $ wmtqi741_nomry0mpgpa0
 
[Root @ test1 conf] #
 
 
 
To delete a user
 
# Htpasswd-D. htpasswd aaa
 
 
 
 
 
 
 
3. Use Basic Authentication for the specified webpage directory
 
For example, access to the test1.demo.com website must be verified based on user authentication.
 
Configure the apache main configuration file:/etc/httpd/conf/httpd. conf
 
NameVirtualHost 192.168.1.123: 80
 

 
DocumentRoot/var/www/Example 1
 
ServerName test1.demo.com
 
ErrorLog logs/test1.demo.com-error. log
 

 
AuthName "realm"
 
AuthType basic
 
AuthUserFile/etc/httpd/conf/. htpasswd
 
Require User aaa bbb
 

 

 
[Root @ test1 restart 1] # service httpd restart
 
Stopping httpd: [OK]
 
Starting httpd: [OK]

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.