zz22 发表于 2018-11-27 06:23:04

Apache的访问权限控制

Apache的访问权限控制

2009-03-17--------第一天
Apache的访问权限控制
简单介绍:这是一个apache的系列配置文档,配置apache的认证授权,此篇为第一篇。
认证类型:basic 基本认证(常用)digest 摘要认证
认证指令:
1.1 authname   受保护域名称
1.2 authtype   认证方式
1.3 authuserfile 认证口令文件位置
1.4 authgroupfile 认证组文件位置
授权指令:
2.1 require user 授权给指定用户
2.2 require group 授权给指定组
2.3 require valid-user 授权给认证口令文件用户
建立用户库:
3.1 基本认证:
#htpasswd –c aurhfile username
#htdbm –TDB –c authfile username
3.2 摘要认证
#htdigest –c authfile username
口令文件格式:username:password
组文件格式:groupname:user1 user2

具体配置步骤:
1.   创建口令文件
Cd /etc/httpd/
Htpasswd –c httppwd test
Htpasswdhttppwd bbs(不要-c 参数会覆盖上一个)

Vi httpd.conf
修改为:

   Optinons Indexes MultiViews
    AllowOverride None
    authname “test”
authtype basic
authuserfile /etc/httpd/httppwd
require user test
                  ##只授权test用户访问

Service httpd restart

#####################################

Vi httpd.conf
修改为:

   Optinons Indexes MultiViews
   AllowOverride None
    authname “test”
authtype basic
authuserfile /etc/httpd/httppwd
require valid-user
       ##口令文件所有用户都可以访问

Service httpd restart

#########################################

Vi httpgrp
添加:
admin: test bbs
wq!

Vi httpd.conf
修改为:

   Optinons Indexes MultiViews
   AllowOverride None
    authname “test”
authtype basic
authuserfile /etc/httpd/httppwd
authgroupfile /etc/httpd/httpgrp
require group admin
       ##admin组可以访问

   Service httpd restart

########################################

不对之处请大家多多批评。*-*




页: [1]
查看完整版本: Apache的访问权限控制