ITPub博客

首页 > IT基础架构 > 网络安全 > 实战apache用户验证(转)

实战apache用户验证(转)

原创 网络安全 作者:post0 时间:2007-08-09 16:50:42 0 删除 编辑
实战apache用户验证(转)[@more@]

本文主要介绍了包含在apache发行版本内的用户验证模块---auth,auth_db

验证模块的使用是很简单的就以下三步

1、创建用于保存用户/密码的文件

2、配置apache以使用那个文件做用户验证

3、可选的创建一个组文件

1、apache_1.3.28的安装。

shell>./configure --prefix=/www --disable-module=all --enable-module=access --enable-module=so --enable-shared=max --enable-module=auth_anon --enable-module=auth --enable-module=auth_db --enable-module=auth_dbm --enable-module=digest --enable-module=alias --enable-module=log_config --enable-module=dir --enable-module=mime

shell>make

shell>make intall

2、创建需要的目录

mkdir /www/auth

mkdir /www/authdb

chown nobody:nobody /www/auth /www/authdb

3、编辑httpd.conf

Alias /auth /www/auth

Alias /authdb /www/authdb

AllowOverride AuthConfig

AllowOverride Authconfig

AuthType Basic

4、在/www/auth,/www/authdb中分别创建.htaccess文件

vi /www/auth/.htaccess

AuthName "password file auth"

AuthUserFile /www/authfile/password

AuthGroupFile /www/authfile/group

Require group test

vi /www/authdb/.htaccess

AuthName "db auth"

AuthDBUserFile /www/authfile/dbuser.dat

Require username1

5、创建密码文件

/www/bin/htpasswd -c /www/authfile/password username1

/www/bin/htpasswd /www/authfile/password username2

创建组文件

echo "test: username1 username2" >> /www/authfiile/group

6、创建密码数据库用于数据库验证

/www/bin/dbmmanage /www/authfile/dbuser.dat adduser username

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8225414/viewspace-938027/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    2018
  • 访问量
    8224875