Skrevet av Emne: Apache no longer has access to script files etc.  (Lest 2989 ganger)

ATC

  • Gjest
Apache no longer has access to script files etc.
« på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • After upgrading Apache, certain CGI scripts no longer seem to work while others work just fine. The log file "/var/log/httpd/error_log" contains messages like this:

    "file permissions deny server execution: /path/to/myscript.cgi"

    Other scripts will execute but can't access its data files. Some of them just fail in various weird ways, others complain about lack of file permissions.



    ATC

    • Gjest
    [Solved] Apache no longer has access to script files etc.
    « Svar #1 på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • Recent rpm versions of Apache run as apache/apache instead of nobody/nobody. The UID and GID are different, which effectively means Apache no longer has ownership of the relevant scripts and/or data files.

    There are two ways to solve this problem:

    * The quick and dirty one: change the UID of the "apache" user from the default 48 to 99 to match the "nobody" user.

    * The proper one: change ownership of all files currently belonging to "nobody" to "apache". This MAY break other user-made services on the server so be careful.

    Also, make sure to set the home directory in /etc/passwd to a directory where the apache/nobody user has write permissions, like /tmp (not recommended unless ALL users are trusted) or a directory created for that purpose (much safer)