Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

-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?

share|improve this answer
    
Thanks all. I chose to just re-chmod the file each time when I re-write it either in the perl or cgi script. Simple enough. Thanks ! –  user770395 Jun 2 '11 at 22:25

On Solaris 10 the default is for apache to run as User nobody, Group nobody (check /etc/apache/httpd.conf User and Group directives). Given your example apache won't be able to write to the cgitestfile as it has no write access to it.

Change the owner:group of dest-dir and the files you want apache to overwrite to nobody

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.