Apache CGI in user directory “End of script output before headers”

后端 未结 8 750
心在旅途
心在旅途 2021-02-04 17:10

I know there are some questions about this topic, but none seems to solve my issue. See this or this or this.

I\'m on Linux, Fedora21, and I\'m trying to enable per user

8条回答
  •  闹比i
    闹比i (楼主)
    2021-02-04 17:29

    I was having a problem executing a python cgi in a userdir.

    /var/log/httpd/error_log reveals:

    [Fri Apr 26 13:09:41.840285 2019] [cgi:error] [pid 25421] [client 98.234.206.134:60837] End of script output before headers: index.cgi

    The user being invoked in the URL was doug, user 42, group 42

    I vaguely remembered suexec having a problem executing cgi scripts for a group or user below 1000.

    So I created a new group called user1k as 1000. Then I did

    adduser -g 1000 -u 1000 dwg
    chmod 755 /home/dwg
    mkdir /home/dwg/public_html
    

    And I placed my python cgi script into this directory.

    Now that the group and user were >= 1000 the script began executing correctly. I am not sure whether it was the user or the group which fixed the problem, but changing them both definitely solved it.

    Note: It was the userid being below 1000 that was the problem. So make the the userID of a userdir cgi executee is > 999.

    Here is an excerpt from the man suexec output.

    Is the target userid ABOVE the minimum ID number? The minimum user ID number is specified during configuration. This allows you to set the lowest possible userid that will be allowed to execute CGI/SSI programs. This is useful to block out "system" accounts.

    Is the target groupid ABOVE the minimum ID number? The minimum group ID number is specified during configuration. This allows you to set the lowest possible groupid that will be allowed to execute CGI/SSI programs. This is useful to block out "system" groups.

提交回复
热议问题