4

For some reason, when I try to save a file (generated by PHP under /www/appname/module) - it is saved under

/tmp/systemd-private-015eb2e9f67b4eef862c68e99fe0ba30-apache2.service-9h6i08

and when aiming files to get saved under

/tmp/somename

files get saved under

/tmp/systemd-private-015eb2e9f67b4eef862c68e99fe0ba30-apache2.service-9h6i08/tmp/somename.

How do i disable this feature and just save files "regularly" to the /tmp directory?

What is the purpose of this default feature anyway?

6

That is a systemd security setting that creates a service specific private temp directory.

Your apache systemd unit will file have a setting:

...
[Service]
ExecStart=...
PrivateTmp=yes
...

This option will ensure that the /tmp directory the service will see is private and isolated from the host system's /tmp. /tmp traditionally has been a shared space for all local services and users. Over the years it has been a major source of security problems for a multitude of services. Symlink attacks and DoS vulnerabilities due to guessable /tmp temporary files are common. By isolating the service's /tmpfrom the rest of the host, such vulnerabilities become moot.
Source: http://0pointer.de/blog/projects/security.html

You can configure multiple services to share a PrivateTmp with JoinsNamespaceOf= which may be desirable to setting PrivateTmp=no

| improve this answer | |
  • where can i find this settings file? I looked in /etc/apache2 and /etc/systemd and I cant see something similar.. – Rick Sanchez May 14 '18 at 11:04
  • See this Q&A on how to modify/customise systemd unit files – HBruijn May 14 '18 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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