【问题标题】:How to stop Apache from listing the contents of my user directories如何阻止 Apache 列出我的用户目录的内容
【发布时间】:2009-12-04 09:59:20
【问题描述】:

我最近在我的网站上运行了一些渗透测试软件,并惊讶于它报告我的一个目录列表可以公开访问。

它是可用的root用户的目录。

http://www.example.com/~root/

此页面内容中的结果:

Index of /~root

    * Parent Directory
    * cgi-bin/

平台:我正在使用 Symfony 在 Linux 和 Apache 上创建 PHP 网站。

我可以通过 Apache 进行配置吗?

【问题讨论】:

  • 许多发行版都包含一个公开这些用户目录的配置文件。您通常可以不包含该配置文件。您可能想在 serverfault 上询问一些更完整的答案。

标签: linux security apache directory-listing


【解决方案1】:

您可以在该目录中创建一个 .htaccess 文件,或者在您的 Apache 配置中使用一个 <directory>...</directory> 块来指定:


Options -Indexes

更多详情请见the Apache options directive documentation

【讨论】:

    【解决方案2】:

    Apache 中有一个命令可以显示索引。

    Options +Indexes
    

    删除这个,重新启动。这将使该 url 显示 403 Forbidden。

    【讨论】:

    • 这就是 Options +Indexes 的作用!谢谢!
    猜你喜欢
    • 1970-01-01
    • 2019-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-22
    • 1970-01-01
    • 2019-01-11
    • 2020-07-07
    相关资源
    最近更新 更多