Linux学习--You don‘t have permission to access /~hadoop/index.html on this server.

在Apache httpd服务器中,启用UserDir配置并尝试访问用户hadoop的public_html目录时遇到权限问题。尽管已设置正确权限,但问题依旧存在。最终发现是由于SELinux未关闭导致,通过修改SELinux配置(setenforce 0)成功解决了访问错误,现在可以正常访问index.html页面。
摘要由CSDN通过智能技术生成

问题:
在httpd.conf配置文件中开启了UserDir配置项,并且在系统中创建了一个hadoop用户,在hadoop的家目录下需要创建一个public_html目录,并在目录中创建一个index.html文件,访问时报错,
在这里插入图片描述


<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    #UserDir disabled

    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disabled" line above, and uncomment
    # the following line instead:
    # 
    UserDir public_html

</IfModule>

解决方法:
最开始一直怀疑是文件权限问题(用户家目录至少要有711权限,用户家目录下的public_html目录至少要有755权限),但是修改文件权限后仍然不行,最后发现是selinux没有关闭造成的,通过setforce 0修改了selinux配置后,问题解决,页面可以正常访问。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值