Apache CGI Script Can Cannot Overwrite a File in a Directory it has full permissions to

apache-2.2cgipermissions

Having a weird problem on a Solaris 10 box. I have a cgi script (perl) which needs to overwrite a file. We do not have suexec running on Apache so the destination directory has full (777) access so that Apache can write to it.

The problem is that the CGI script is able to write a new file to the directory but not overwrite an existing file.

**Directory permissions for file destination:** 

drwxrwxrwx 146 myuser white      32768 Jun  2 20:46 dest-dir

**File Permissions of file that needs to be over written:** 

-rw-r--r--   1 myuser white      0 Jun  2 20:50 cgitestfile

Anyone know a simple solution for resolving this ??

Seems like apache can only overwrite a file if it owns it.

Best Answer

-rw-r--r-- 1 myuser white 0 Jun 2 20:50 cgitestfile

You only have write permissions on the file for owner (myuser) Is apache running as user myuser? or as apache or www.data or something like that? Perhaps you need to add write access for other?