LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

What is stored in the /tmp directory?

/tmp is shared scratch space that any user can write to; the system auto-deletes files there after about 10 days, so nothing in it is permanent.

Its whole purpose is throwaway storage. Programs need somewhere to drop intermediate files mid-task, and /tmp is the agreed-upon spot — world-writable so any process can use it, and automatically swept (files untouched for ~10 days are removed) so it never silently fills the disk. On many systems it's also a tmpfs, meaning it lives in RAM: very fast, and cleared completely on reboot.

That convenience comes with a real security catch. Because everyone can write to /tmp, you can't assume a file you find there is yours, and you must lock down anything sensitive. The right way to create temp files is to let the system pick a guaranteed-unique, safely-permissioned name:

mktemp /tmp/myapp.XXXXXX   # creates e.g. /tmp/myapp.a7Bz9q, owned only by you

Gotcha: never store secrets or rely on a predictable name like /tmp/myfile — a malicious user could pre-create that name (a "symlink attack") and trick your program into writing somewhere dangerous. mktemp exists precisely to avoid this.

From Quiz: LIOS / Files and Directories | Updated: Jun 20, 2026