Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Settings for apache-set user authentication for directories or files

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Set up user authentication for a directory or file

Add the following configuration to the corresponding CVM configuration file:

AllowOverride AuthConfig

AuthName "The administrator authentication!"

AuthType Basic

AuthUserFile / data/.htpasswd

Require valid-user

The path after Directory is the directory or file to be authenticated by the user, AuthName followed by a custom verification prompt, and AuthUserFile followed by a verification file.

Create a verification file using htpasswd, a tool that comes with apache:

# / usr/local/apache2/bin/htpasswd-cm / data/.htpasswd username

New password:

Re-type new password:

Adding password for user username

# cat / data/.htpasswd

Username:$apr1 $wLVEgNIh$Ne.IU7FgjfPBZsP6SocZ11

The parameter-c means to create a new file, and-m means to encrypt the password with MD5, followed by the path to the authentication file. Username is the user name.

# / usr/local/apache2/bin/apachectl-t

Syntax OK

Check that the configuration file is correct

# / usr/local/apache2/bin/apachectl graceful

Graceful means to reload the configuration file

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.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report