CentOS 7 Httpd Cgi Script File Not Able To Write To /tmp

Home » CentOS » CentOS 7 Httpd Cgi Script File Not Able To Write To /tmp
CentOS 5 Comments

Hi all,

I have a script running in httpd. The script runs fine. However I want to “echo” some debug information into a file. The file is never created.

Is there some security thing that has to be enable/disabled to allow a script in httpd to write to a file?

Thanks,

Jerry

5 thoughts on - CentOS 7 Httpd Cgi Script File Not Able To Write To /tmp

  • Just a speculation but /tmp is usually world-writable which leads me to suspect SELinux (or AppArmor with other distros.)

    —– Original Message —

  • Fun fact… If I echo my data to the same directory as the script is located in it works. But it does not allow writing to /tmp

    I’m good with that.

    Thanks,

    Jerry

  • The behavior you describe should be normal for any web server, as it is for Apache, which is what I use. It is a security feature that prevents malicious attacks on a web server from writing malware anywhere else in the filesystem and possibly gaining elevated privileges.

  • Something (possibly systemd) creates per user / per process (?) /tmp directories.

    These are actually held in /tmp/systemd-private-*

    Gary

LEAVE A COMMENT