/tmp directory overview

Web servers have a directory named /tmp used to store temporary files. Many programs use this /tmp directory for writing temporary data and generally remove the data when it is no longer needed. Otherwise the /tmp directory is cleared when the server restarts.

Shared servers

On shared hosts, the /tmp directory is shared among all customers on the server. On a private server the /tmp directory is not shared, but is limited in size to 128MB.

When the /tmp directory becomes full, some programs stop working. For example, it is no longer be possible to upload a file to a site since there is no room in the /tmp folder to store the temporary file while it's uploading.

Creating your personal /tmp directory

To maintain control of the temporary storage for files and add security for things such as sessions, you can configure the software to use any directory you want for temporary storage. It is often desirable to make this directory within your own user space (outside the web accessible directory). For example, create a /tmp directory in the following location:

/home/<username>/tmp

Here you can control the /tmp folder while your files are protected from view by others on the server. You would control this directory based on the programming language your site is using. For example, if your site is using PHP, view the following link:

VPS servers

VPS users often see their /tmp directory filling up. For example, you may see a Failed to write when attempting to upload to your site. This is because it's only 128MB by default. If this is an issue, you have two options:

  • Reboot your server. When the server restarts, the /tmp directory is automatically cleared.
  • Contact DreamHost support. Support is able to remove this limitation from your VPS.

See also

Did this article answer your questions?

Article last updated .