suPHP 导致目录所有权错误

suPHP causing error for directory ownership

[Fri Mar 11 14:48:20 2016] [error] [client 181.236.205.241] SoftException in Application.cpp:594: Directory /home/myuser/public_html is not owned by myuser

如何在不赋予目录所有权 myuser 的情况下修复此错误。它必须是不同的用户。

我可以使用一些 suphp.conf 配置吗?

编辑 可以一起更改主文件夹的所有权,但我不确定这是否会解决 suPHP 问题

EDIT2 我想做这一切的原因是因为一个大网站被黑了。作为措施之一,不是修复整个庞大的应用程序,而是取消对 apache 服务器的文件夹和文件的写入权限。服务器不应再有权写入重命名或创建文件。为此,我显然必须取消文件/文件夹的所有权。

我尝试过的背景:

这是来自 Application.cpp 的一些代码(从 http://www.suphp.org/Download.html 下载)

    UserInfo directoryOwner = directory.getUser();
    if (directoryOwner != owner && !directoryOwner.isSuperUser()) {
        std::string error = "Directory " + directory.getPath()
            + " is not owned by " + owner.getUsername();
        logger.logWarning(error);
        throw SoftException(error, __FILE__, __LINE__);
    }

看起来如果你让所有者成为超级用户(root 可能是最简单的),错误可能会消失。

冒着陈述显而易见的风险,命令将是这样的

$sudo chown root /home/myuser/public_html

编辑以在评论中添加更多与问题相关的代码

try {
    // Change working directory to script path
    API_Helper::getSystemAPI().setCwd(
        File(scriptFilename).getParentDirectory().getPath());
    if (mode == TARGETMODE_PHP) {
        std::string interpreterPath = interpreter.substr(4);
        CommandLine cline;
        cline.putArgument(interpreterPath);
        API_Helper::getSystemAPI().execute(interpreterPath, cline, env);
    } else if (mode == TARGETMODE_SELFEXECUTE) {
        CommandLine cline;
        cline.putArgument(scriptFilename);
        API_Helper::getSystemAPI().execute(scriptFilename, cline, env);
    }
} catch (SystemException& e) {
    throw SoftException("Could not execute script \"" + scriptFilename
                            + "\"", e, __FILE__, __LINE__);
}