...
- For auxiliary storage for data that does not need to, or otherwise cannot, reside in memory
- As a means of communicating with other processes by transferring data through the file system
When temporary files are needed for storage, they should be created either in a secure directory (see FIO15-A. Ensure that file operations are performed in a secure directory) or jail (see FIO16-A. Limit access to files by creating a jail). This will help protect these files from unintended access by attackers.
Temporary files are also used to communicate between two or more collaborating processes. For example, one process will create a temporary file in a shared directory with a well-known name, or a temporary name that is then communicated between processes. The file then can be used to share information among these collaborating processes.
...