目录共享linux,linux实现家目录的web共享,并基于basic验证

此功能是基于模块mod_userdir.so实现

1 vim /etc/httpd/conf.d/userdir.conf

#UserDir disabled

UserDir public ##指定共享目录的名称

#

# Control access to UserDir directories. The following is an example

# for a site where these directories are restricted to read-only.

#

#

# AllowOverride FileInfo AuthConfig Limit Indexes

# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

# Require method GET POST OPTIONS

#

#目录授权

allowoverride authconfig #启用目录.htacces配置文件

2 vim /home/wang/public/.htaccess

authtype basic #启用basic验证

AuthName "admin Page" #主页名字

AuthUserFile "/etc/httpd/conf.d/.httpuser" #用户名单

AuthGroupFile "/etc/httpd/conf.d/.httpgroup" #用户组

Require group g1 g2 #授权的用户组

3

htpasswd -c /etc/httpd/conf.d/.httpuser tom

root:~ # cat /etc/httpd/conf.d/.httpuser

bob:$apr1$uiGJnnta$malpOQNXO1H6PXkSFBQLp.

tom:$apr1$G3CLOH6u$3azhfaSvBcQKnd2sHrYdo1

alice:$apr1$TMnblcB2$ui69X.78BLx.yYg9igwAW0

4

mkdir ~wang/public

echo 'test1\' > /~wang/public/index.html

setfacl -m u:apache:x ~wang/

4测试

访问 http://YOU-ip/~wang/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值