更改虚拟目录权限时来自 apache Web 服务器的 CentOS/Linux 权限错误


CentOS/Linux Permission error from apache web server when changing virtual directory permissions

我需要在我自己管理的托管 CentOS VPS 上创建 SSH 帐户。我希望他们只能访问自己的主目录。我想避免CHRoot监狱,以保持简单。我希望通过 linux 文件权限实现这一目标。

到目前为止我做了什么:

  1. 我使用以下方法备份了现有权限:getfacl -R/> permissions.acl
  2. 我运行了一个操作,该操作将删除所有世界/其他用户访问权限。 chmod -R o-rx/(递归修改根的权限,删除其他/世界组上的读取和执行。
  3. 经测试的现有站点:

抱歉不能发布图片,因为我是新手,没有声誉

Forbidden
You don't have permission to access /index.htm on this server.
Apache/2.2.15 (CentOS) mod_fcgid/2.3.7 PHP/5.3.3 mod_python/3.3.1 Python/2.6.6 mod_ssl/2.2.15 OpenSSL/1.0.0-fips mod_perl/2.0.4 Perl/v5.10.1 Server at www.ponmanconstructions.com Port 80
  1. 已恢复已知的工作配置。

知道为什么会发生这种情况吗?

具有

工作配置的文件夹中的 ls -l

drwxrwxr-x  6 apache    root 4096 Jul 22 07:28 mysite.com

所需配置中文件夹上的 ls -l(此配置会导致禁止错误)

drwxrwx---  6 apache    root 4096 Jul 22 07:28 mysite.com

Apache用户也属于Apache组,所以如果你不给该组读取和执行权限,那么它就会变成其他人,即为什么你会得到禁止的错误。

谢谢和问候,
阿洛克·塞克