Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't my apache process write to my world-writeable file?

I'm having this problem and I reached a deadlock, I would try anything I've reached a deadend. My problem goes like this:

I have a Perl/CGI script installed on Fedora 9 machine running apache2, this script have a config file which placed in the same directory, this config file has 777 permissions.

The script can't write to the file. It can read but in no way could I get it to write to it. The file is owned by the same user the apache is running. I wrote a small PHP script to test and placed it in the same folder. The PHP script can read but can't write to it.

I'm so desperate here and I don't know where to start with problem, so any help to get me on the right way would be appreciated.

EDIT: I can open the file for editing from command line; it is apache who can't access it

EDIT2: the folder hierarchy /var/www/cgi-bin/script
permissions are like this
/var root 755
www root 755
cgi-bin root 755
script apache 755

EDIT: The problem was in selinux. I disabled it and the script had access to the file thanks for everyone contributed

Thanks in advance

like image 589
w43L Avatar asked Dec 06 '25 06:12

w43L


1 Answers

Does apache run with some selinux profile or similar that prevents it writing in that directory?

like image 171
Douglas Leeder Avatar answered Dec 07 '25 20:12

Douglas Leeder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!