4

I accidentally deleted systemd-private-015eb2e9f67b4eef862c68e99fe0ba30-apache2.service-9h6i08 from my /tmp folder:

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

and didn't mean for it not to disappear permanently. I was sure it would get displayed back again. This makes my code break since it's not finding the secured folder to write files to it.

How do I return the file back again?

I tried creating the directory again - with only root permissions and ownership - but this doesn't work.

vvvvv
  • 175
  • 8
mah. nah.
  • 59
  • 1
  • 3
  • 20
    Nothing in /tmp should be crucial to a system, as it's explicitly meant to be emptied after a reboot. Restarting the service should fix it. – Shadur May 14 '18 at 11:50
  • 1
    It may not be crucial to the system - but it surely shouldn't be expected that you can remove files created by running processes without adversely affecting them? :) – Niall Litchfield May 15 '18 at 08:36
  • 1
    "didn't mean for it not to disappear permanently" huh? Too many negatives there. – Barmar May 15 '18 at 17:50
  • @NiallLitchfield it is intended by design that deleting any files in `/tmp` shall not affect any processes. If a process is affected by deleting a tmpfile, its a badly programmed process. A process should hold a filepointer opened to its tmpfile in `/tmp` to block any attempts of third party processes or should make sure that no other process than a root process is able to interact with its tmpfile in a destructive way. – paladin Apr 13 '22 at 13:05

1 Answers1

23

Restarting Apache should recreate it (with a slightly different name).

Assuming Debian/Ubuntu:

sudo systemctl restart apache2 
Sven
  • 97,248
  • 13
  • 177
  • 225