Why can't apache access files in /tmp?

Peter Flynn peter at silmaril.ie
Tue Oct 30 22:26:57 UTC 2018


On 30/10/18 15:37, Chris Green wrote:

> There is a
> directory systemd-private-e0d672d5d6814aed8f48c266641180ea-apache2.service-BDQ84c
> in /tmp though.

That's it. It had me baffled too. Red Hat and its derivatives (eg
CentOS) all implement containers for /tmp *inside* /tmp, so on CentOS I
have:

> drwx------ 3 root root 16 Jan  5  2018
systemd-private-9996399d21cb4a4aab2104dab700f938-colord.service-pc1Qll
> drwx------ 3 root root 16 Jul 30 19:22
systemd-private-9996399d21cb4a4aab2104dab700f938-httpd.service-HnGnni
> drwx------ 3 root root 16 Jul 30 19:23
systemd-private-9996399d21cb4a4aab2104dab700f938-mariadb.service-h49ThQ
> drwx------ 3 root root 16 Jan  5  2018
systemd-private-9996399d21cb4a4aab2104dab700f938-rtkit-daemon.service-zvbLbZ
> drwx------ 3 root root 16 Jan  5  2018
systemd-private-9996399d21cb4a4aab2104dab700f938-vmtoolsd.service-Fk1yKw

Basically, the executing apache process sees /tmp as
/tmp/systemd-private-9996399d21cb4a4aab2104dab700f938-httpd.service-HnGnni/tmp
and it cannot access the normal /tmp at all.

I believe an equivalent is now default on other architectures (apache2
above implies Debian-based systems, I think, where RH/CentOS still use
httpd).

As far as I can see these do NOT get cleared out at reboot, but you
could have a line in /etc/rc.local which does the job, eg

   /bin/rm -rf /tmp/systemd-private*httpd.service*/tmp/*

///Peter




More information about the ubuntu-users mailing list